How do you substitute x(1),x(2),x(3) in place of kp,ki and l respectively?

1 次查看(过去 30 天)
y=((1/10^(l + 1)*ki*kp*l*sin((pi*l)/2))/(kp + (ki*kp*cos((pi*l)/2))/10^l) - (1/10^(l + 1)*ki^2*kp^2*l*cos((pi*l)/2)*sin((pi*l)/2))/(10^l*(kp + (ki*kp*cos((l*pi)/2))/10^l)^2))/((1/10^(2*l)*ki^2*kp^2*sin((pi*l)/2)^2)/(kp + (ki*kp*cos((l*pi)/2))/10^l)^2 + 1) - (1/(25*((2^(1/2)*10^(1/2))/5 + 1)^2) - (2^(1/2)*10^(1/2))/(100*((2^(1/2)*10^(1/2))/5 + 1)))/(4/(5*((2^(1/2)*10^(1/2))/5 + 1)^2) + 1)
How do you substitute x(1),x(2),x(3) in place of kp,ki and l respectively so that i can convert it into a function in x: @x y ?

回答(2 个)

James Tursa
James Tursa 2020-4-22
编辑:James Tursa 2020-4-22
To keep your equation the same, e.g.,
y1 = @(kp,ki,l) ((1/10^(l + 1)*ki*kp*l*sin((pi*l)/2))/(kp + (ki*kp*cos((pi*l)/2))/10^l) - (1/10^(l + 1)*ki^2*kp^2*l*cos((pi*l)/2)*sin((pi*l)/2))/(10^l*(kp + (ki*kp*cos((l*pi)/2))/10^l)^2))/((1/10^(2*l)*ki^2*kp^2*sin((pi*l)/2)^2)/(kp + (ki*kp*cos((l*pi)/2))/10^l)^2 + 1) - (1/(25*((2^(1/2)*10^(1/2))/5 + 1)^2) - (2^(1/2)*10^(1/2))/(100*((2^(1/2)*10^(1/2))/5 + 1)))/(4/(5*((2^(1/2)*10^(1/2))/5 + 1)^2) + 1);
y = @(x) y1(x(1),x(2),x(3));

VBBV
VBBV 2021-9-5
编辑:VBBV 2021-9-5
syms kp ki l
y= ((1/10^(l + 1)*ki*kp*l*sin((pi*l)/2))/(kp + (ki*kp*cos((pi*l)/2))/10^l) - (1/10^(l + 1)*ki^2*kp^2*l*cos((pi*l)/2)*sin((pi*l)/2))/(10^l*(kp + (ki*kp*cos((l*pi)/2))/10^l)^2))/((1/10^(2*l)*ki^2*kp^2*sin((pi*l)/2)^2)/(kp + (ki*kp*cos((l*pi)/2))/10^l)^2 + 1) - (1/(25*((2^(1/2)*10^(1/2))/5 + 1)^2) - (2^(1/2)*10^(1/2))/(100*((2^(1/2)*10^(1/2))/5 + 1)))/(4/(5*((2^(1/2)*10^(1/2))/5 + 1)^2) + 1);
yy = subs(y,[kp ki l],[x(1) x(2) x(3)])

类别

Help CenterFile Exchange 中查找有关 Numbers and Precision 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by