Error in find command....
이전 댓글 표시
t=linspace(xq(1),xq(np),1001)
y2=polyval(pmon,t)
plot(t,y2,'k--',x)
for j=1:6
for i=1:1001;
t1(j)=find(y2(i)=pmon(j))
end
end
i want to find value of t(x axis) for which value of pmon(y axis) is given ??
답변 (1개)
Adam Danz
2019년 3월 14일
One equal sign assigns a value to a variable.
Two equal signs perfoms a comparison between A and B and returns a logical value.
t1(j) = find(y2(i) = pmon(j)) %incorrect
t1(j) = find(y2(i) == pmon(j)) %correct
댓글 수: 12
shoaib Ch
2019년 3월 14일
madhan ravi
2019년 3월 14일
Remember you are dealing with float numbers so add tolerance.
Adam Danz
2019년 3월 14일
Please provide the full copy-pasted error message and relevant code that produces the error.
shoaib Ch
2019년 3월 14일
Adam Danz
2019년 3월 14일
There must be a mistake with the code you provided.
1) the first line causes an error because the vector is not enclosed in [brackets].
2) the loop k=1:pos_a, pos_a is a vector, not an integer.
Adam Danz
2019년 3월 14일
if pos_a(k)>= pos_a(k)+1
How would this ever be true?
shoaib Ch
2019년 3월 15일
Adam Danz
2019년 3월 15일
I understand how the 'if' command works. What I don't understand is what you're trying to do with it. Your statement
if pos_a(k)>= pos_a(k)+1
is analogous to
if x >= x+1
which would never be the case.
Did you mean to this?
if pos_a(k)>= pos_a(k+1)
Sorry, I don't understand your last question above.
shoaib Ch
2019년 3월 15일
Adam Danz
2019년 3월 15일
Please provide a minimal working example so I can reproduce your problem.
shoaib Ch
2019년 3월 15일
shoaib Ch
2019년 3월 15일
카테고리
도움말 센터 및 File Exchange에서 Medical Physics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

