for loop for non integer values

2 vues (au cours des 30 derniers jours)
sara hosseini
sara hosseini le 12 Jan 2018
Hi all, Can you help me please with this code that I stuck!? I want to solve a fifth order polynomial for values of time(t) between (1:0.3.10) I use the code below, but all the time the value of piks the integer i values ( 1,2,3,4,5,6,7,8,9,10) and it does not calculate E for non integer values(0.3, 0.6, 0.9 ...) Where is the problem? Could you please help me?
clc
clear all
syms a3 a4 a5 t
x=a3*t.^3+a4*t.^4+a5*t.^5;
for i=1:0.5:10;
x1=subs(x,t,i);
x_p=subs(diff(x,t),t,i);
x_pp=subs(diff(x,t,2),t,i);
eqns=[x1==75, x_p==0, x_pp==0];
S=solve(eqns,[a3,a4,a5]);
a3_5=S.a3;
a4_5=S.a4;
a5_5=S.a5;
L=subs(x,[a3,a4,a5],[a3_5,a4_5,a5_5]);
L_p=diff(L);
L_pp=diff(L,2);
J=0.000011*L_pp.^2;
E(i,:)=vpa(int(J,[0,i]))
digits(4);
end

Réponses (0)

Catégories

En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by