Dubble sin in first order Differential Equation
Show older comments
Hi,
I'm very new to matlab so this might be a dumb question but,
I'm trying to solve a first order differential equation with a dubble sin,
but everytime I add a sin to the y matlab gives a "Invalid expression" error.
Does anyone know how to solve this problem?
h = 0.01;
begin = 0.0;
end = 5;
x = begin:h:end;
y = zeros(size(x));
y(1) = 2;
for i=1:numel(y)-1
f = sin(y(i).)*sin(x(i).^2)
y(i+1) = y(i) + h .* f;
end
plot(x,y);
grid on;
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!