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

2 views (last 30 days)
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 ?

Answers (2)

James Tursa
James Tursa on 22 Apr 2020
Edited: James Tursa on 22 Apr 2020
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 on 5 Sep 2021
Edited: VBBV on 5 Sep 2021
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)])

Community Treasure Hunt

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

Start Hunting!