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.

ex193b.m
% ex193b.m:  RKF Solution to dy/dx=1+x^3-x^2y		
clear all,  echo off, close all
f=inline('1+x^3-x^2*y','x','y');
x1=input('x1=  (e.g. 0) ');  y1=input('y1=  (e.g. 2) ');
[X Y]=ode45(f, [x1 3], y1, odeset('abstol',1e-8,  'reltol',1e-8));
figure(1),  plot(X,X, 'b',  X,Y),  grid on,  axis([0 3 0 3]) 
title('dy/dx=1+x^3-x^2y '),  xlabel('x'),  ylabel('RKF solution')
Yex=(Y(1)-X(1)).*exp( X(1).^3/3- X.^3/3)+X;
figure(2),  plot(X,Y-Yex),  grid on,  title('Solution Error'), xlabel('x')

Contact us