Problem with equations solver
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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)
0 commentaires
Réponses (1)
Areej Varamban Kallan
le 2 Août 2018
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);
0 commentaires
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!