-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotSignal.m
28 lines (25 loc) · 986 Bytes
/
plotSignal.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function plotSignal(Fs,output) %Plots the signal in Timme & Freq domain
time = linspace(0,length(output)/Fs,length(output));
mixLen = length(output);
iFs = 1/Fs;
mixF0 = 1/(iFs*mixLen);
f= 0:mixF0: (mixLen-1)*mixF0;
%f = (0:length(output)-1)*100/length(output);
figure;
subplot(2,2,[1 2]);
plot(time,output);grid; %Time domain
title('Signal In Time Domain');
xlabel('Time (Sec)');
ylabel('Output');
subplot(2,2,3);
foutput = fftshift(fft(output));
plot(f,abs(foutput));
title('Magnitude'); %Magnitude
xlabel('Frequency');
ylabel('Magnitude');
subplot(2,2,4);
plot(f,angle(foutput)*180/pi); %Phase
title('Phase');
xlabel('Frequency');
ylabel('Phase');
end