필터 지우기
필터 지우기

Constant Amplitude from a Sine Wave

조회 수: 5 (최근 30일)
Mark
Mark 2013년 2월 28일
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.

채택된 답변

Youssef  Khmou
Youssef Khmou 2013년 3월 1일
편집: Youssef Khmou 2013년 3월 1일
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
Mark
Mark 2013년 3월 1일
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 2013년 3월 1일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Sources에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by