对于矩形脉冲,我有以下代码:
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中计算它,或者手动评估它?
发布于 2017-04-07 00:36:57
时间信号的长度应该足够长,才能在频域上获得适当的分辨率。
拜托,试着像这样改变你的时间周期。
t=[-100:dt:100];在三角信号方面,我认为brainkz的评论是最好的。
在你的情况下,请像这样改变你的时间信号。
x=0.5*max(10-abs(t),0);https://stackoverflow.com/questions/43266298
复制相似问题