Professional Documents
Culture Documents
When you divide by your vector, you should use ./ to do the element by
element operation. Using just / does the vector version of the operation,
which gives you the error. (notice the ./ ):
>> x = (0:0.001:1);
>> y = 1./(1+sin(2*pi*50*x).^2);
>> plot (x(1:100),y(1:100))
7- Use the fft command to find the frequency components of the vector y in the
previous problem.
x = (0:0.001:1);
y = 1./(1+sin(2*pi*50*x).^2);
plot(x,y);
y1 = fft(y);
N = length(x);
f = [0:N-1]*50/(N-1);
plot(f,abs(y1));
% time vector
% sinusoidal signal
% FFT of y
% N = length of fft
% frequency vector
% plot magnitude
8- Use the command eig to find the eigenvalues 1 , 2 and eigenvectors of the
system
1
(1000 [
1
>> A=1000*[1,-1;-1,2];
>> B=[1,0;0,2];
>> EIG=eig(A,B)
EIG =
1.0e+003 *
0.2929
1.7071
>> [v,d]=eig(A,B)
v=
-0.7071 -0.7071
-0.5000 0.5000
d=
1.0e+003 *
0.2929
0
0
1.7071
1
1
][
2
0
0 1
0
]) { } = { }
2
2
0