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 symengineDivision 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 allpo=1010*10^2;Dp=6*10^2;L=1000*10^3;f=10^(-4);rho=1.2;syms x yP=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);
Best Answer