필터 지우기
필터 지우기

Problem with equations solver

조회 수: 1 (최근 30일)
Carlo Pezzoli
Carlo Pezzoli 2018년 7월 18일
답변: Areej Varamban Kallan 2018년 8월 2일
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
Areej Varamban Kallan 2018년 8월 2일
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