Solve a system of differential equations in MATLAB when one function is known

37 Views Asked by At

I have an equation:

equation

where t and v(t) are known. I have to find u(t).

I wrote a program:

function dudt = odefcn(t, u, v)
    dudt = v.^2 * u + v .* u + diff(v);
end

[t,u] = ode45(@(t,u) odefcn(t,u,v), tspan, u0);

The problem is that the function v(t) is a vector that has the same dimension as t. Finally, I see the error that dimensions do not match.

0

There are 0 best solutions below