MATLAB: How to make the vectors the same lenght to plot ? plot (t,z)

fft

syms f
f=[0 0 4 9];
y = fft(f)
Fs = 16;
t= [0:1/Fs:1.5];
x=exp(-2*t);
plot(t,x);
grid;
xlabel('time');
ylabel('Freq');
title('Part 2a');
y=fft(x);
m=abs(y);
plot(t,m);
grid;
xlabel('time');
ylabel('abs');
ylabel('abs');
p=((2*pi)/(50*0.1));
w= [0.5:p:(2*pi/0.4)];
x= 1./(2+(j*w));
plot (w,x);
xlabel('time');
ylabel('fourier transform');
title('The Fourier transform');
f= exp(-2*t);
t= 0:0.1:1.5;
x= fft(f);
z= abs(x);
u= z*0.1 ;
plot(t,z);
title('plot function');
xlabel('Time');
ylabel('abs') ;
hold on

Best Answer

Your code has
f= exp(-2*t);
t= 0:0.1:1.5;
which uses the old t, t= [0:1/Fs:1.5]; to create f, and then changes t to a different length. Reverse the order of those two lines.