the error here in equalization an ordinary variable in symbolic the error in E and says:" Conversion to double from sym is not possible." wt can ii do???

1 Ansicht (letzte 30 Tage)
syms x;
syms y;
rt=[x y];
xloc=[1 2 4 5];
yloc=[23 45 67 44];
N=4;
noOfratios=6;
E=[ones(1,1),ones(1,1)]
%s=5*ones(1,length(N));
for i=1:N
di=rt-[xloc(i),yloc(i)]
E(i,1)=1./(abs(di).^2);
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);
di=[xloc(i)-xloc(j),yloc(i)-yloc(j)]
p(i,j)=(k(i,j).*(abs(di)))./(1-k(i,j).^2)
end

Antworten (1)

Walter Roberson
Walter Roberson am 4 Apr. 2011
Umm, exactly which line does it say it on?
And where did you get the idea that the single symbolic variable "r", which is never assigned a value, could be indexed at (i,2) and (j,2) at the Matlab level?
  3 Kommentare
Walter Roberson
Walter Roberson am 4 Apr. 2011
Is there a point in doing the abs() before doing the .^2 ? Are you expecting imaginary values or only real values?
SAM alimostafa
SAM alimostafa am 4 Apr. 2011
no points i want to ignore negative values and only real values is expecting

Melden Sie sich an, um zu kommentieren.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by