Solve a system of equations for a closed form with a parameter
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Walter Roberson
on 6 Feb 2022
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.
See Also
Categories
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!