Problem with equations solver

1 次查看(过去 30 天)
Hi all, I've got a problem with the equations solver. I'm sure that my code is wrong (in the function "solve") because I've used symbolic functions, but I don't know where is the mistake.
e
syms alpha(t) beta(t) c(t)
eqns = [(a*cos(alpha))+(b*cos(beta))==0 , (a*sin(alpha))+(b*sin(beta))==c];
sol = solve(eqns, [c, beta]);
ALPHA=0:pi/100:4*pi;
plot(ALPHA, subs(sol.c(2,1), alpha(t) ,ALPHA))
eqns_dot=diff(eqns, t)

回答(1 个)

Areej Varamban Kallan
Hi Carlo,
I understand that you are having issues when using the 'solve' function to solve symbolic equations.
When solving symbolic equations using 'solve(eqn,vars)', 'vars' should be an array of symbolic variables and not symbolic functions. Moreover when using 'plot(x,y)', 'x' and 'y' must be numeric, datetime, duration or an array convertible to double. Here I assume a = 2 and b = 3 and substitute these in sol.c when plotting.
syms a b c alpha(t) beta
eqns = [(a*cos(alpha))+(b*cos(beta))==0 , (a*sin(alpha))+(b*sin(beta))==c];
sol = solve(eqns, [c, beta]);
ALPHA=0:pi/100:4*pi;
plot(ALPHA, subs(sol.c(2,1), {alpha(t) ,a,b},{ALPHA,2,3}));
eqns_dot=diff(eqns, t);

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by