Solve the system of nonlinear equations (with symbolic variables) with the command fsolve
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
C1 The output of the following program is a set of nonlinear equations. How to solve it with the fsolve command. For different N and M.
clc
close all
clear all
syms t f alpha
f1=2*t-t^4+(2/gamma(7/3))*t^(4/3);
alpha=1/3;
N=2;
M=2;
l=N*M;
for n=1:N
for m=0:M-1
kesy((n-1)M+m+1,1)=nchoosek(M-1,m)(N*t-n+1)^(m)*(n-N*t)^(M-1-m);
end
end
kesy;
for n=0: N-1
for m=0:M-1
for i=0:M-1
A(n*M+m+1,n*M+i+1)=N*M*int(kesy(n*M+m+1,1),(n*M+i)/(N*M),(n*M+i+1)/(N*M));
end
end
end
A;
B=inv(A);
if l==1 P=(1/l)^alpha*(1/gamma(alpha+2));
else
for k=1:l-1
f(k)=(k+1)^(alpha+1)-2*k^(alpha+1)+(k-1)^(alpha+1);
end
f;
for i=1:l
for j=1:l
if i==j F(i,j)=1;
elseif i>j F(i,j)=0;
elseif i<j F(i,j)=f(j-i);
end
end
end
P1=(1/l)^alpha*(1/gamma(alpha+2))*F;
end
F=P1;
P=A*F*B;
for n=1:l
coeff(n)=l*int(f1,(n-1)/l,n/l);
end
w=coeff;
fT=w*A;
C=sym('c%d',[1,l]);
FA=C*P*A;
C1=C*A+C*P*A-FA.^2-fT;
C1=transpose(C1)
0 Kommentare
Antworten (1)
Steven Lord
am 16 Jun. 2022
fsolve is intended to solve a system of equations numerically. Since your system of equations involves symbolic variables you will need to use solve or vpasolve from Symbolic Math Toolbox to solve them.
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!