Constant Amplitude from a Sine Wave

14 views (last 30 days)
I am trying to transform a normal 50Hz sine wave (frequency will not change) into a constant amplitude value. I have done so with an RMS block in SimPowerSystems. But I am wondering what way would you do it? Any suggestions.

Accepted Answer

Youssef  Khmou
Youssef Khmou on 1 Mar 2013
Edited: Youssef Khmou on 1 Mar 2013
hi Mark,
So you are talking about square wave or Pulse train, there are many ways to generate or derive that signal from Cos/Sin wave :
Let us derive an example and derive the signal by two ways :
Fs=120;
t=0:1/Fs:1;
F=50;% Hz
%Phi=1.33;
y=2*sin(t*F);
1.Solution 1 : using a loop :
n=length(y);
Pulse_train=zeros(1,n);
Max=max(y);
Min=min(y);
%y(y>0)=Max;
%y(y<0)=Min;
for x=1:n
if y(x)>0
Pulse_train(x)=Max;
elseif y(x)<0
Pulse_train(x)=Min;
else
Pulse_train(x)=y(x);
end
end
figure, plot(t,Pulse_train), axis ([0 1 -3 3])
2.Using Built-in Mathw(c) function :
y2=2*square(t*F);
figure, plot(t,y2), axis ([0 1 -3 3]), hold on, plot(t,Pulse_train,'r')
There are many ways , either by using the software or using Electronic devices , and by the way take a look at this Mathw(c) Example that illustrates :The Fourier series expansion for a square-wave altough this method has the disadvantage of Gibbs effect : http://www.mathworks.com/products/matlab/examples.html?file=/products/demos/shipping/matlab/xfourier.html
  3 Comments
Mark
Mark on 1 Mar 2013
Thanks for you answer, I see what you are doing.
I am using this in a power system model in Simulink (SimPowerSystems). At one of my buses I am getting an 11kV sine wave. I want to convert it to a constant amplitude value in order to use it in a proportional control system against a constant reference. Is there a way you know of using blocks in simulink do that?
Youssef  Khmou
Youssef Khmou on 1 Mar 2013
hi,
i Do not know exactly the function that performs that but :
1.type in the command prompt "dsplib" and take a look at the library try to find something useful .
2. Create a Embedded M file in Simulink, i think this is good solution, a M-file as function where the input is the 11Kv Sinusoid and write the conditions necessary to obtain the pulse train
i hope this helps

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!