Error with Subs Function
Ältere Kommentare anzeigen
I using the following code to create a grid of the values for equation SF with numnerical values for x1 and x2 but have encountered the following error...
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 Orthogonality_Check (line 51)
S2(i,j)=subs(S1(i),x2,iX1(j));
When I compute each value separately I do not have a problem, any advice would be appreciated thanks!
P.S values in grid are expected to be zero is this the cause of the problem?
% - Define variables
x1 = sym('x1');
x2 = sym('x2');
% - =======================================================================
% - Define dU and fu and create orthogonality function
f = [-1+9*x1-2*x1^3+9*x2-2*x2^3; 1-11*x1+2*x1^3+11*x2-2*x2^3];
dU = [2*x1^3-10*x1+x2+1;2*x2^3-10*x2+x1];
fu = f+dU;
Org = dU'*fu;
% - =======================================================================
% - Integrate orthogonal function
SF = int(Org);
% - =======================================================================
% - Set Limits for x1,x2...
LMB = 2;
n = 10;
iX1 = linspace(-LMB,LMB,n+1);
iX2 = linspace(-LMB,LMB,n+1);
for i=1:length(iX1)
S1(i)=subs(SF, x1,iX1(i));
for j=1:length(iX1)
S2(i,j)=subs(S1(i),x2,iX1(j));
end
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!