暂且
This commit is contained in:
parent
b2b2cfc429
commit
259423ad3f
1 changed files with 54 additions and 0 deletions
54
Matlab/lab2.m
Normal file
54
Matlab/lab2.m
Normal file
|
@ -0,0 +1,54 @@
|
|||
figure(1);
|
||||
Ts = 1/50;
|
||||
t = 0:Ts:10-Ts;
|
||||
x = sawtooth(t,0.5);
|
||||
plot(t,x)
|
||||
xlabel('Time (seconds)')
|
||||
ylabel('Amplitude')
|
||||
|
||||
figure(2);
|
||||
y = fft(x);
|
||||
fs = 1/Ts;
|
||||
f = (0:length(y)-1)*fs/length(y);
|
||||
plot(f,abs(y))
|
||||
xlabel('Frequency (Hz)')
|
||||
ylabel('Magnitude')
|
||||
title('Magnitude')
|
||||
|
||||
figure(3);
|
||||
Ts = 1/50;
|
||||
t = 0:Ts:10-Ts;
|
||||
x = exp(-3*t);
|
||||
plot(t,x)
|
||||
xlabel('Time (seconds)')
|
||||
ylabel('Amplitude')
|
||||
|
||||
figure(4);
|
||||
y = fft(x);
|
||||
fs = 1/Ts;
|
||||
f = (0:length(y)-1)*fs/length(y);
|
||||
plot(f,abs(y))
|
||||
xlabel('Frequency (Hz)')
|
||||
ylabel('Magnitude')
|
||||
title('Magnitude')
|
||||
|
||||
|
||||
figure(5);
|
||||
syms w t;
|
||||
X=w*sin(3/2*w)*2/3;
|
||||
subplot(2,2,1);
|
||||
ezplot(X,[-10,10]);
|
||||
iX=ifourier(F,t);
|
||||
subplot(2,2,2);
|
||||
ezplot(iX,[-10,10]);
|
||||
subplot(2,2,3);
|
||||
ezplot(abs(X),[-10,10]);
|
||||
im=imag(X);
|
||||
re=real(X);
|
||||
phase=atan(im/re);
|
||||
subplot(2,2,4);
|
||||
ezplot(phase,[-10,10]);
|
||||
|
||||
figure(6);
|
||||
[H,W]=freqs([1,-1],[1,1]);
|
||||
plot(abs(W),H);
|
Reference in a new issue