【发布时间】:2017-04-06 21:45:43
【问题描述】:
我有以下 矩形 脉冲代码:
clear all
dt=.001;
t=[-25:dt:25];
x=(5/2)*(sign(t+10)-sign(t-10));
%subplot(2,2,1);
plot(t,x);
title('Rectangular pulse with width 10ms');
xlabel('time(ms)');
ylabel('Amplitude(V)');
axis([-25 25 0 6]);
>> y=fftshift(fft(x)); % moving the zero-frequency component to the center of the array
N=length(y); %to take the frquecny axis of the hoarmonics.
n=-(N-1)/2:(N-1)/2; %divide the frequency compone
f=sqrt(y.*conj(y)); % to take the amplitude of each hoarmony.
title('Rectangular pulse amplitude');
xlabel('frequency component(harmoney)');
ylabel('Amplitude of the harmoney');
plot(n,f);
axis([-50 50 0 150000]);
>>
>> y=fftshift(fft(x)); % moving the zero-frequency component to the center of the array
N=length(y); %to take the frquecny axis of the hoarmonics.
n=-(N-1)/2:(N-1)/2; %divide the frequency compone
f=sqrt(y.*conj(y)); % to take the amplitude of each hoarmony.
title('Rectangular pulse amplitude');
xlabel('frequency component(harmoney)');
ylabel('Amplitude of the harmoney');
plot(n,f);
axis([-50 50 0 150000]);
如何获得三角脉冲?
另外,上面的代码没有找到矩形信号的傅里叶变换。如何找到它?如何找到三角信号?是否可以在 MATLAB 中计算或手动评估?
【问题讨论】:
-
将
x=(5/2)*(sign(t+10)-sign(t-10));更改为x=max(5-abs(t),0); -
你可以手动做 FT,你可以谷歌一些关于它的讲义。 MATLAB 也可以做到:mathworks.com/help/symbolic/fourier.html