Dubble sin in first order Differential Equation
Afficher commentaires plus anciens
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;
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!