No BSD License  

Highlights from
Alternative Mathematics using MATLAB 7

image thumbnail

Alternative Mathematics using MATLAB 7

by

 

13 Mar 2003 (Updated )

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

ex191.m
% ex191.m:  Direction Field for dy/dx=-y						          
clear all
F=inline('-Y', 'X', 'Y');
xmax=4;  delx=xmax/30;  
ymax=3;  dely=ymax/30;	
[Xm,Ym]=meshgrid(0:delx:xmax, 0:dely:ymax);
Dx=Xm-Xm+1;				% Unit x-components of arrows
Dy=F(Xm,Ym);				% Compute y-components
L=sqrt(Dx.^2+ Dy.^2);			% Initial length of [Dx Dy]
L=L+1e-10;					% Add small number to avoid L=0
Dx1=Dx./L;  Dy1=Dy./L;		% Unit length for all arrows
figure(1),  quiver(Xm,Ym,   Dx1,Dy1,'.'),  grid on
   axis([0 xmax 0 ymax]),  title('Direction Field for dy/dx=-y')

Contact us