Hello! I have been given a problem of ordinary differential equations to be solved in matlab by ode45. The equations are on a sheet but you can see what equations i put in. I did as the teacher instructed but matlab gives me a error message. Can you see what I misunderstood? :/
'prim' is the vector of derivatives so I think I have written the problem in the right structure.
The Attempt at a Solution
First m-file, the function file (name blandning.m):
function prim = blandning(tid, x1, x2, x3, s, q, w); s = 1; q = 1; w = 0.1610; %Parameters prim = [s*(x2 - x2*x1 + x1 - q*x1^2); -s^(-1)*(x2 - x1*x2 + x3); w*(x1 - x3)]; end
clc clear all s = 1; q = 1; w = 0.1610; %Parameters x1 = 30; x2 = 1; x3 = 30; %intialconditions tf = 10; %final time x0 = [x1; x2; x3]; %intial vector tid = [0, tf]; [t, x] = ode45(blandning, t, x0, , s, q, w); plot(t, x)
"??? Input argument "x2" is undefined.
Error in ==> blandning at 7
prim = [s*(x2 - x2*x1 + x1 - q*x1^2); -s^(-1)*(x2 - x1*x2 + x3); w*(x1 - x3)];
Error in ==> Huvud at 17
[t, x] = ode45(blandning, t, x0, , s, q, w);
Thanks for all help possible!