Error in find command....
Mostrar comentarios más antiguos
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 ??
Respuestas (1)
Adam Danz
el 14 de Mzo. de 2019
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 comentarios
shoaib Ch
el 14 de Mzo. de 2019
madhan ravi
el 14 de Mzo. de 2019
Remember you are dealing with float numbers so add tolerance.
Adam Danz
el 14 de Mzo. de 2019
Please provide the full copy-pasted error message and relevant code that produces the error.
shoaib Ch
el 14 de Mzo. de 2019
Adam Danz
el 14 de Mzo. de 2019
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
el 14 de Mzo. de 2019
if pos_a(k)>= pos_a(k)+1
How would this ever be true?
shoaib Ch
el 15 de Mzo. de 2019
Adam Danz
el 15 de Mzo. de 2019
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
el 15 de Mzo. de 2019
Adam Danz
el 15 de Mzo. de 2019
Please provide a minimal working example so I can reproduce your problem.
shoaib Ch
el 15 de Mzo. de 2019
shoaib Ch
el 15 de Mzo. de 2019
Categorías
Más información sobre Medical Physics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

