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 view (last 30 days)
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

Answers (1)

Walter Roberson
Walter Roberson on 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 Comments
Walter Roberson
Walter Roberson on 4 Apr 2011
Is there a point in doing the abs() before doing the .^2 ? Are you expecting imaginary values or only real values?

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!