Help with Symbolic For Loop
조회 수: 1 (최근 30일)
이전 댓글 표시
So I have this code, and it works. But I can't figure out how to get it to store the answers of each of the 3 iterations. It only stores the last. I know it's something simple, maybe I've just been at it too long, but I can't seem to figure it out.
The Pnew = P(i) is in relation to P being 3 different load cases, i.e P = [0, 22.25, 44.5]
syms w(x) v(x)
Dw = diff(w);
Dv = diff(v);
for i = 1:1:3
Pnew = P(i)
% Delection in y direction
ode_v = diff(v,x,2) == -Izz/(E*den)*(Pnew*(L-x));
cond1_v = v(0) == 0;
cond2_v = Dv(0) == 0;
conds_v = [cond1_v cond2_v];
vSol(x) = dsolve(ode_v,conds_v);
vSol = vpa(simplify(vSol),3)
% Delection in Z direction
ode_w = diff(w,x,2) == Iyz/(E*den)*(Pnew*(L-x));
cond1_w = w(0) == 0;
cond2_w = Dw(0) == 0;
conds_w = [cond1_w cond2_w];
wSol(x) = dsolve(ode_w,conds_w);
wSol = vpa(simplify(wSol),3)
end
댓글 수: 2
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!