필터 지우기
필터 지우기

Solve an eqution in matlab

조회 수: 2 (최근 30일)
ana take
ana take 2017년 1월 9일
댓글: Niels 2017년 1월 16일
Hello! How can I write this equation in matlab: The variable here is t, all other variables including Rt are known.I want to find t by solving D(t)=R(t).

채택된 답변

Niels
Niels 2017년 1월 9일
편집: Niels 2017년 1월 9일
D(t)=R_t
<=> D(t)-R_t=0
use fzero
tSolution=fzero(D(t)-R_t,0)
but care, the output can be contain more than 1 solution, if D and R have more than 1 intersection point
  댓글 수: 2
ana take
ana take 2017년 1월 13일
Here x, y,teta are vectors.When I call the function fzero it shows this message:fzero(@(t)shkruajek(x,y,1,3,teta,0.1,4,t),0)
Exiting fzero: aborting search for an interval containing a sign change
because NaN or Inf function value encountered during search.
(Function value at -2.54232e+306 is NaN.)
Check function or try again with a different starting value.
ans =
NaN
can you help me to determine where is the problem here??
function [ek]=shkruajek(x,y,i,j,teta,speed,R,t)
ek=sqrt(((x(i)+ speed*cos(teta(i)*t)) - (x(j) + speed*sin(cos(teta(j)*t))))^ 2+ ((y(i) + speed*sin(teta(i)*t)) - (y(j) + speed*sin(teta(j)*t))).^ 2)-R;
end
a=fzero(@(t)shkruajek(x,y,i,j,teta,speed,R,t),0);
Niels
Niels 2017년 1월 16일
this means that the function has no roots... maybe plot the function first or check if it has a sign change. Did you enter the right function?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by