필터 지우기
필터 지우기

Error in find command....

조회 수: 1 (최근 30일)
shoaib Ch
shoaib Ch 2019년 3월 14일
편집: shoaib Ch 2019년 4월 2일
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 ??
  댓글 수: 2
shoaib Ch
shoaib Ch 2019년 3월 14일
it is not giving me value for t , i want to use it for finding roots
Adam Danz
Adam Danz 2019년 3월 14일
Have you implemented the correction suggested in the answers section below?
If you've implemented that correction and 't' is empty, that means there were no matches between y2(i) and pmon(i).

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

답변 (1개)

Adam Danz
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
shoaib Ch 2019년 3월 15일
xq=[ -3, -2, -1, 2, 6, 7];
yq=[ 1, -2, 1, -2, 2, -2];
pmon=[-61/840, 49/60, -1663/840, -1693/420, 169/15, 73/7]; %interpolation values
t=linspace(xq(1),xq(6),1001) %values of xq
y2=polyval(pmon,t)
plot(t,y2,'k--')
Now i want to chect weather there exist a root between pmon values ,next program give me root values
for i=1:5;
if pmon(i)<0 & pmon(i+1)>0
pos_a(i)=pmon(i)
elseif pmon(i)>0 & pmon(i+1)<0
pos_a(i)=pmon(i)
else
end
now , pos_a is values of y axis and i want to find what be the values of t (x values) which give me these y values according to data ... for this i use that code but its not working
for i=1:5;
if pos_a(i)>= pos_a(i+1)
s0=t(pos_a(i))% ..statements to get the root in t(pos a(i)) to t(pos a(i+1))
s1=t(pos_a(i+1))
else
s1=t(pos_a(i)) % ..statements to get the root in t(pos a(i)) to t(pos a(i+1))
s0=t(pos_a(i+1))
end
end
And and Thanx again for your Kindness
shoaib Ch
shoaib Ch 2019년 3월 15일
Figure 1.jpg
if these be pos_a values than what be t values ??

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

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by