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!

