利⽤matlab绘制傅⾥叶分解三维图
版权声明:本⽂为博主原创⽂章,未经博主允许不得转载。 blog.csdn/Stynis/article/details/80531168
⽬的:
1. 理解傅⾥叶变换分析及其他⽅法的分析。
2. 理解傅⾥叶变换频域与时域的关系。
3. 利⽤MATLAB绘制傅⾥叶变换图形三维图。
内容和原理:
本次主要使⽤的函数及其说明如下(此处只取采⽤⽤法的意义说明):
1.abs:abs(X) is the absolute value of the elements of X. When
X is complex, abs(X) is the complex modulus (magnitude) of
the elements of X.
2.figure: figure, by itself, creates a new figure window, and returns
its handle.
3.square: square(T) generates a square wave with period 2*Pi for the
elements of time vector T. square(T) is like SIN(T), only
it creates a square wave with peaks of +1 to -1 instead of
a sine wave.
4. Fft: fft(X,N) is the N-point fft, padded with zeros if X has less
than N points and truncated if it has more.
5. plot3:plot3(x,y,z), where x, y and z are three vectors of the same length,
plots a line in 3-space through the points whose coordinates are the
elements of x, y and z.
结果与分析:
1. 根据要求需要⾸先产⽣具有⾜够采样频率的⽅波,我采⽤了square函数⽣成⽅波,频率设置为1Hz,采样频率则为100Hz。
2. 接着进⾏傅⾥叶变换,利⽤fft函数,⽣成N个分解波形,N越⼤,分解次数越多,频谱越精密,实验中采⽤N=512进⾏实验。
3. 利⽤plot3函数进⾏绘图并投影。
产⽣的⽅波图如下:
产⽣频谱图如下:
绘制三维图像如图:
程序代码如下:
N=512;
fs=100;
t=-2:1/fs:2;
m=square(2*pi*t);
plot(t,m);
axis([-1 1 -2 2]);
figure();
title('⽅波');
b=fft(m,N);
matlab求傅里叶变换
mag=abs(b);
plot(mag);
figure();
x=-5:0.01:5;
for i=1:length(b)
for k=1:length(x)
z(k)=abs(b(i))*sin((i-1)*x(k)+angle(b(i)));
y(k)=i;
end
figure(3);
grid on;
plot3(x,y,z);
hold on;
x_z=zeros(1,length(x))+6;
plot3(x_z,y,abs(z));
hold on;
end
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论