Solve a system of equations for a closed form with a parameter
조회 수: 2 (최근 30일)
이전 댓글 표시
I am very new to this discussion forum. I want to solve for unknown variable X1,X2,X3,X4 which varies for different values of X5. With hand calculation i am able to come up with a solution of y. But unable to do so in MATLAB. Following is the code. Thank you in advance
clc
clear all
L=1
syms X1 X2 X3 X4 X5 x;
V= [X1 X2 X3 X4]';
s= [sin(X5*x) cos(X5*x) sinh(X5*x) cosh(X5*x)]
s1= diff(s,x);
s2= diff(s,x,2);
s3= diff(diff(s,x,2),x,1);
V1= subs(s,x,0)
V2= subs(s1,x,0)
V3= subs(s,x,L)
V4= subs(s1,x,L)
e0 = V1*V == 0;
e1 = V2*V ==0;
e2 = V3*V ==0;
e3 = V4*V ==0
sol027 = solve([e0, e1, e2,e3], [X1, X2, X3, X4, X5]) %Where y=s*V;
댓글 수: 0
답변 (1개)
Walter Roberson
2022년 2월 6일
According to your description, your X5 is an input constant. You should not be trying to solve for X5 -- you are trying to solve 4 equations for 5 variables, one of which is an input.
L=1
syms X1 X2 X3 X4 X5 x real
V= [X1 X2 X3 X4]';
s= [sin(X5*x) cos(X5*x) sinh(X5*x) cosh(X5*x)]
s1= diff(s,x);
s2= diff(s,x,2);
s3= diff(diff(s,x,2),x,1);
V1= subs(s,x,0)
V2= subs(s1,x,0)
V3= subs(s,x,L)
V4= subs(s1,x,L)
e0 = V1*V == 0
e1 = V2*V ==0;
e2 = V3*V ==0;
e3 = V4*V ==0;
eqn = [e0, e1, e2,e3].'
sol027 = solve(eqn, [X1, X2, X3, X4]) %Where y=s*V;
You can see by examination that X1 = X2 = X3 = X4 satisfies the equations.
참고 항목
카테고리
Help Center 및 File Exchange에서 Equation Solving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!