Quickly create symmetric/ antisymmetric piecewise function to use in simulink
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I need to create the curve in red below.
It is a periodic piecewise function with period T = 2*pi, defined in the first quarter period [0,pi/2] by:
2M*1.73/pi* cos(x-pi/6) if 0<x<pi/3
2M*1.73/pi* 1.73 * cos(x) if pi/3<x<pi/2
where M = 0.907.
After that, as you can see in the picture, highlighted in red, the function continues between pi/2 and pi being the antisymmetric of the previous.
Between pi and 2*pi, again it is the symmetric of all the previous.
I am using this code
syms y(x);
M = 0.907;
coeff = 2 * M * sqrt(3)/pi;
cond1 = x>0&x<pi/3;
cond2 = x>pi/3&x<pi/2;
val1 = coeff*cos(x-pi/6);
val2 = coeff*sqrt(3) * cos(x);
y(x) = piecewise( cond1, val1, cond2, val2 );
fplot(y(x))
to plot the first quarter of the function.
I am able to wrap my mind and plot the function all the way up til 2*pi, but it is not flexible.
How can I quickly plot all the function in [ 0, 2*pi ]?
how can I make it periodic of period T = 2*pi?
Please keep in mind I don't want to discretize the function using any linspace, I should be able to query the function and get the exact value, not an interpolated one.
This is not school homework, the function comes from a book about three phase electric motor space vector modulation.
I plan of using this function as an output in simulink.
Thank you!

0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression 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!