I am having trouble with some Matlab code that I am writing. I am attempting to solve ODE writing my own code, per the Professor. That means I cannot use ODE45 or other built-in functions.(adsbygoogle = window.adsbygoogle || []).push({});

My problem: Oiler, a play on Euler, calls another function, FX, that contains the two equations that I am attempting to solve. Oiler is called from the command line by the operator (me).

Command line:

[X,Y] = oiler('bloodtest',2,3,3,4)

Function # 1:

function [rhs] = oiler(FX,a,b,n,h)

r=[a;b]

s=ones(1,n)

t=ones(1,n)

rhs=[s;t]

rhs(:,1)=feval(FX,r);

for i=2:n;

rhs(:,i)=rhs(:,i-1)+feval(FX,rhs(:,i-1))*h

i=i+1;

end

Function # 2:

function [dx,dy] = bloodtest(x,y)

[dx,dy]=[x.^2;2.*y];

I get error flags saying 'too many outputs' for function #2, but I have not yet found a way to call the second function using a vector as the argument.

Any help will be appreciated

Bill

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Another Matlab problem

Loading...

Similar Threads for Another Matlab problem |
---|

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

MATLAB Matlab-like software |

MATLAB Matlab data into bins |

**Physics Forums | Science Articles, Homework Help, Discussion**