Error using mupadengine/feval_internal First argument must be a condition.
Show older comments
Hi , I keep getting this error message "First argument must be condition" evidently regarding the set up in line 14 in the given code:
syms r x k z l m ph
% l=zeta1, m=zeta2
[ph,r] = meshgrid((0:5:360)*pi/180,0:.5:10);
[X,Y] = pol2cart(ph,r);
Z = X+1i*Y;
J = besselj(k,l.*r);
J2 = besselj(k,m.*r);
Y = bessely(k,l.*r);
Y2 = bessely(k,m.*r);
H = besselh(k,r);
F1=symsum(J.*exp(1i*k*ph),k,-5,5);
F2=symsum((J2+Y2).*exp(1i.*k.*ph),k,-5,5);
F3=symsum(H.*exp(1i.*k.*ph),k,-5,5);
pwu = piecewise(0<r & r<0.5, F1, 0.5<r & r<1, F2, r>1, F3);
U= subs(pwu, {l, m, r, ph}, {1.5, 3, 0<r & r<4, 0<ph & ph<2*pi });
surf(X,Y,double(real(U)))
hold on
surf(X,Y,zeros(size(X)))
hold off
Error using mupadengine/feval_internal
First argument must be a condition.
Error in sym/piecewise (line 49)
pw = feval_internal(symengine, 'piecewise', lists{:}, 'ExclusiveConditions');
Error in piecewi_u (line 14)
pwu = piecewise(0<r & r<0.5, F1, 0.5<r & r<1, F2, r>1, F3);
I am using r as a variable with phi (ph), and even if I change this variable, I get the same error again.
Can anyone suggest a fix of this code?
Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Resizing and Reshaping Matrices 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!