Optimization of multiple variables
3 次查看(过去 30 天)
显示 更早的评论
Hi,
I want to optimize three functions y1,y2,y3,all of them have three variables a1,a2,a3. However, I kept getting errors.Could someone help me?Thx!!!
I try to optimize using fminsearch.
x0=[0 0 0]
result = fminsearch(@optfun,x0);
This is the three functions I want to optimize,and I make them into a vector called optfun(z).
function [y1,y2,y3] = optfun(z)
a1 = z(1);
a2 = z(2);
a3 = z(3);
y1 = abs(vpa("0.122")*a1*sym(1i) + vpa("0.00895")*a2*sym(1i) + vpa("7.32e-4")*a3*sym(1i) + vpa("1530.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("102.0i"))/abs(vpa("0.122")*a1*sym(1i) + vpa("0.00895")*a2*sym(1i) + vpa("7.32e-4")*a3*sym(1i) - vpa("1530.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("102.0i"));
y2 = abs(vpa("0.176")*a1*sym(1i) + vpa("0.0129")*a2*sym(1i) + vpa("0.00106")*a3*sym(1i) - vpa("2200.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("147.0i"))/abs(vpa("0.176")*a1*sym(1i) + vpa("0.0129")*a2*sym(1i) + vpa("0.00106")*a3*sym(1i) + vpa("2200.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("147.0i"));
y3 = abs(vpa("0.223")*a1*sym(1i) + vpa("0.0163")*a2*sym(1i) + vpa("0.00134")*a3*sym(1i) + vpa("2790.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("186.0i"))/abs(vpa("0.223")*a1*sym(1i) + vpa("0.0163")*a2*sym(1i) + vpa("0.00134")*a3*sym(1i) - vpa("2790.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("186.0i"));
end
回答(1 个)
Florian Bidaud
2023-8-23
编辑:Florian Bidaud
2023-8-23
I assume you want to have three solutions optimizing respectively y1, y2 and y3 ?
In this case you need to split them into 3 functions:
x0=[0 0 0];
result1 = fminsearch(@optfun1,x0)
result2 = fminsearch(@optfun2,x0)
result3 = fminsearch(@optfun3,x0)
function y1 = optfun1(z)
a1 = z(1);
a2 = z(2);
a3 = z(3);
y1 = abs(vpa("0.122")*a1*sym(1i) + vpa("0.00895")*a2*sym(1i) + vpa("7.32e-4")*a3*sym(1i) + vpa("1530.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("102.0i"))/abs(vpa("0.122")*a1*sym(1i) + vpa("0.00895")*a2*sym(1i) + vpa("7.32e-4")*a3*sym(1i) - vpa("1530.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("102.0i"));
end
function y2 = optfun2(z)
a1 = z(1);
a2 = z(2);
a3 = z(3);
y2 = abs(vpa("0.176")*a1*sym(1i) + vpa("0.0129")*a2*sym(1i) + vpa("0.00106")*a3*sym(1i) - vpa("2200.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("147.0i"))/abs(vpa("0.176")*a1*sym(1i) + vpa("0.0129")*a2*sym(1i) + vpa("0.00106")*a3*sym(1i) + vpa("2200.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("147.0i"));
end
function y3 = optfun3(z)
a1 = z(1);
a2 = z(2);
a3 = z(3);
y3 = abs(vpa("0.223")*a1*sym(1i) + vpa("0.0163")*a2*sym(1i) + vpa("0.00134")*a3*sym(1i) + vpa("2790.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("186.0i"))/abs(vpa("0.223")*a1*sym(1i) + vpa("0.0163")*a2*sym(1i) + vpa("0.00134")*a3*sym(1i) - vpa("2790.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("186.0i"));
end
Or maybe you want to minimize the sum of these three functions ?
In this case :
x0=[0 0 0];
result = fminsearch(@optfun,x0)
function y = optfun(z)
a1 = z(1);
a2 = z(2);
a3 = z(3);
y1 = abs(vpa("0.122")*a1*sym(1i) + vpa("0.00895")*a2*sym(1i) + vpa("7.32e-4")*a3*sym(1i) + vpa("1530.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("102.0i"))/abs(vpa("0.122")*a1*sym(1i) + vpa("0.00895")*a2*sym(1i) + vpa("7.32e-4")*a3*sym(1i) - vpa("1530.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("102.0i"));
y2 = abs(vpa("0.176")*a1*sym(1i) + vpa("0.0129")*a2*sym(1i) + vpa("0.00106")*a3*sym(1i) - vpa("2200.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("147.0i"))/abs(vpa("0.176")*a1*sym(1i) + vpa("0.0129")*a2*sym(1i) + vpa("0.00106")*a3*sym(1i) + vpa("2200.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("147.0i"));
y3 = abs(vpa("0.223")*a1*sym(1i) + vpa("0.0163")*a2*sym(1i) + vpa("0.00134")*a3*sym(1i) + vpa("2790.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("186.0i"))/abs(vpa("0.223")*a1*sym(1i) + vpa("0.0163")*a2*sym(1i) + vpa("0.00134")*a3*sym(1i) - vpa("2790.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("186.0i"));
y = y1 + y2 + y3;
end
Maybe you want to do something else, in any case, fminsearch will only minimize the first output, therefore you need to come up with one variable to minimize, or to call it three times
2 个评论
Florian Bidaud
2023-8-23
Well, technically, since y1, y2 and y3 are positive, if you minimize y1 + y2 + y3, and find a solution for which y1 + y2 + y3 = 0 then you will have y1 = 0, y2 = 0 and y3 = 0, and therefore you will have solve you system.
You can then use :
x0=[0 0 0];
result = fminsearch(@optfun,x0)
function y = optfun(z)
a1 = z(1);
a2 = z(2);
a3 = z(3);
y1 = abs(vpa("0.122")*a1*sym(1i) + vpa("0.00895")*a2*sym(1i) + vpa("7.32e-4")*a3*sym(1i) + vpa("1530.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("1530.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("102.0i"))/abs(vpa("0.122")*a1*sym(1i) + vpa("0.00895")*a2*sym(1i) + vpa("7.32e-4")*a3*sym(1i) - vpa("1530.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("1530.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("102.0i"));
y2 = abs(vpa("0.176")*a1*sym(1i) + vpa("0.0129")*a2*sym(1i) + vpa("0.00106")*a3*sym(1i) - vpa("2200.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("2200.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("147.0i"))/abs(vpa("0.176")*a1*sym(1i) + vpa("0.0129")*a2*sym(1i) + vpa("0.00106")*a3*sym(1i) + vpa("2200.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("2200.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("147.0i"));
y3 = abs(vpa("0.223")*a1*sym(1i) + vpa("0.0163")*a2*sym(1i) + vpa("0.00134")*a3*sym(1i) + vpa("2790.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) + vpa("2790.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("125.0") + vpa("186.0i"))/abs(vpa("0.223")*a1*sym(1i) + vpa("0.0163")*a2*sym(1i) + vpa("0.00134")*a3*sym(1i) - vpa("2790.0i")/(vpa("50.0") + vpa("0.001")*a3 + vpa("0.01")*a2 + vpa("0.1")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("8.0e-6")*a3 + vpa("4.0e-4")*a2 + vpa("0.02")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("6.4e-5")*a3 + vpa("0.0016")*a2 + vpa("0.04")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("5.12e-4")*a3 + vpa("0.0064")*a2 + vpa("0.08")*a1) - vpa("2790.0i")/(vpa("50.0") + vpa("2.16e-4")*a3 + vpa("0.0036")*a2 + vpa("0.06")*a1) + vpa("25.0") + vpa("186.0i"));
y = y1 + y2 + y3;
end
However, as Stephen23 said, this is not the best way to solve a system.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Special Values 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!