Using Solve Function for range returns error "Assignment has more non-singleton rhs dimensions than non-singleton subscripts"
Show older comments
Hi there,
I'm trying to find a solution set over a range of X,Y,Z for a simple equation. I used nested for loops to run through the X,Y,Z and the solve function and on the second step through I get the error "Assignment has more non-singleton rhs dimensions than non-singleton subscripts" I've been reading through other posts and do not understand where this error is coming from.
This is my code snippet:
a = 100;
b = 50;
X = 0:.1:10;
Y = 0:.1:10;
Z = 0:.1:10;
for i = 1:length(X)
for j = 1:length(Y)
for k = 1:length(Z)
syms L
PHI = X(i)/(1+L) + (Y(j)+Z(k))/((b/a)^2+L)==0;
Lsol(i,j,k) = solve(PHI,L);
end
end
end
and the full error is :
Error using subsasgn
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Error in sym/privsubsasgn (line 997)
L_tilde2 = builtin('subsasgn',L_tilde,struct('type','()','subs',{varargin}),R_tilde);
Error in sym/subsasgn (line 834)
C = privsubsasgn(L,R,inds{:});
I didn't know if anyone else has run into this problem before but it seems like there is something simple that I am missing here.
Thanks,
Anthony
Accepted Answer
More Answers (0)
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!