must return a column vector
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
gnanaguru murugan
le 18 Juin 2021
Commenté : gnanaguru murugan
le 18 Juin 2021
code:
function dy = phy_ode_1(t,y)
dy = zeros(length(y),1);
const=0.5;
sp=-0.5:0.5:14.5;
top=0;
p_crit=sp+top;
dy=const*(y-p_crit);
end
call fun:
[t,y]=ode45('phy_ode_1',0:0.5:10,35)
i got erro, must return column vector. could you help me?
0 commentaires
Réponse acceptée
Alan Stevens
le 18 Juin 2021
Do you want something like this
sp=-0.5:0.5:14.5;
for i = 1:length(sp)
[t,y(:,i)]=ode45(@(t,y) phy_ode_1(t,y,sp(i)),0:0.5:10,35);
end
plot(t,y)
function dy = phy_ode_1(~,y,sp)
const=0.5;
top=0;
p_crit=sp+top;
dy=const*(y-p_crit);
end
Plus de réponses (1)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
