Constant Amplitude from a Sine Wave
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Akzeptierte Antwort
Youssef Khmou
am 1 Mär. 2013
Bearbeitet: Youssef Khmou
am 1 Mär. 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 Kommentare
Youssef Khmou
am 1 Mär. 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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sources finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!