필터 지우기
필터 지우기

ITERATIVE SOLUTION OF ONE UNKNOWN VALUE IN AN EQUATION

조회 수: 5 (최근 30일)
Kamilu Sanusi
Kamilu Sanusi 2023년 11월 2일
편집: John D'Errico 2023년 11월 2일
Please I need an iput on how to solve the value of t in the following equation x = cos(t) - y*sin(t).
%% Solution for t
x = 0.9991/1.02;
y = 2.1838/1.2544;

채택된 답변

John D'Errico
John D'Errico 2023년 11월 2일
편집: John D'Errico 2023년 11월 2일
Hint: try solving for t.
syms x y t
tsol = solve(x == cos(t) - y*sin(t),t)
tsol = 
So there are two solutions. Much of the time, a fully real solution will not exist. That will depend on the values of x and y.
subs(tsol,[x,y],[0.9991/1.02,2.1838/1.2544])
ans = 
vpa(ans)
ans = 
You can ignore the imaginary part of that, since it is essentially a VPA zero.
Alternatively, you could just use fzero.
txyfun = @(t,x,y) cos(t) - y*sin(t) - x;
x = 0.9991/1.02;
y = 2.1838/1.2544;
tfun = @(t) txyfun(t,x,y);
First, PLOT IT. Does a solution exist?
fplot(tfun)
yline(0)
So it would appear there are infinitely many solutions. fzero can find one of them. I don't even need to give it a brack around a root in this case.
[tval,fval,exitflag] = fzero(tfun,0)
tval = 0.0117
fval = 0
exitflag = 1

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by