Info

この質問は閉じられています。 編集または回答するには再度開いてください。

could any one help me to find wt is the error in this code????

1 回表示 (過去 30 日間)
SAM alimostafa
SAM alimostafa 2011 年 4 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
xnetloc=[4 5 7 8]
ynetloc=[23 4 56 89];
syms x;
syms y;
syms r; rt=[x y];
r=[xnetloc;ynetloc];
N=4;
noOfratios=6;
s=5;%assumption bs hek mbd2yan 3shan elqanoon
for i=1:N
for j=1:N
E(i)=(s/(abs((rt-r(i,j)).^2))); end end
for i = 1:noOfratios
j = setdiff(1:noOfratios,i);
k(i,j)=E(i)/E(j);
end
for i = 1:noOfratios
j = setdiff(1:noOfratios,i);
c(i,j)=(r(i,2)-k(i,j)*r(j,2))/(1-k(i,j).^2);%centre coordinates
p(i,j)=k(i,j)*(abs(r(i,2)-r(j,2)))/(1-k(i,j).^2);
%radius coordinates
f=((x-c(i,1))^2)-((y-c(i,2))^2)-p(i)^2)
hold on
ezplot(f)
end
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 4 月 1 日
Please go in to the editor and select your code and click on the 'Code {}' button, so as to reformat the code to be readable.

回答 (2 件)

Sean de Wolski
Sean de Wolski 2011 年 4 月 1 日
You have one too many parenthesis on this line:
f=((x-c(i,1))^2)-((y-c(i,2))^2)-p(i)^2)
  1 件のコメント
SAM alimostafa
SAM alimostafa 2011 年 4 月 1 日
the error in this line
c(i,j)=(r(i,2)-k(i,j)*r(j,2))/(1-k(i,j).^2)
it says because i used symbolic values division in this way is not allowed can you help me in this matter??

Walter Roberson
Walter Roberson 2011 年 4 月 1 日
Your code
for i=1:N
for j=1:N
E(i)=(s/(abs((rt-r(i,j)).^2)));
end
end
Would have the same effect as
j = N;
for i = 1:N
E(i)=(s/(abs((rt-r(i,j)).^2)));
end
Are you sure that is what you intended?
  1 件のコメント
SAM alimostafa
SAM alimostafa 2011 年 4 月 3 日
the error in division of symbolic variables i don't know how to solve it
E(i)=(s.*(1/(abs((rt-[xloc(i),yloc(i)]).^2))));

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by