Division by zero in sym using subs
Show older comments
Hey there, I am trying to use the subs() function in a sym matrix. However when I try to run it I run into an error which is :
Error using symengine
Division by zero.
Error in sym/subs>mupadsubs (line 160)
G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 145)
G = mupadsubs(F,X,Y);
Error in script (line 64)
Vg3=subs(Vg2,x,-L/2:1000:L/2);
I know I am getting this because my elements are dividing by zero, but I tried to avoid everything by making all the x and y elements where they are 0 to be equal to NaN, however it still gives me an error. Would appreciate some help from the expert. The code is as follows:
clear all
po=1010*10^2;
Dp=6*10^2;
L=1000*10^3;
f=10^(-4);
rho=1.2;
syms x y
P=po+Dp*cos((pi*sqrt(x^2+y^2))/L);
parderx=diff(P,x);
pardery=diff(P,y);
Vg=(1/(f*rho))*parderx;
Ug=(-1/(f*rho))*pardery;
Vg2=subs(Vg,y,0);
Vg3=subs(Vg2,x,-L/2:1000:L/2);
Vg3=double(Vg3);
Accepted Answer
More Answers (0)
Categories
Find more on Operations on Strings in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!