No BSD License  

Highlights from
Alternative Mathematics using MATLAB 7

image thumbnail

Alternative Mathematics using MATLAB 7



13 Mar 2003 (Updated )

Self-instructive text on undergraduate algebra, statistics, differential and integral calculus.

% ex201.m:  Euler's solution to y''= -cy						       
clear all
c=1.0;						% Value for k/m
n=1000;		h=0.01;
while 1==1						% Forever true
   T(1)=0;						% Start time, SI units ...
   Y(1)=input('y1=   (e.g. 0) ');				% Initial position
   Yp(1)=input('yp1=  (e.g. 1) ');			% Initial velocity
      if  (Y(1)==0) & (Yp(1)==0),  break,  end	% & means AND
   for i= 1: n-1
      T(i+1)= i*h;
      [dydt dypdt]=spring( T(i), Y(i), Yp(i));
      Y(i+1)=Y(i)+ dydt*h;
      Yp(i+1)=Yp(i)+ dypdt*h;			% Y-prime
figure(1),  plot(T,Y,  T,Yp),  grid on,  title('y"= -cy')
   xlabel('time'),  legend('Y', 'Yp')	

Contact us