in simulink for fourier transformation I do not get any answer in frequency output.

1 Ansicht (letzte 30 Tage)
Hi guys
I write a simulink file based on a youtube fim.(https://www.youtube.com/watch?v=bGOxBAVMFKw) I try to make it
e.when I write it it does not give me any result in frequenct in scop after (ABS block). I attche the simulink file. and also I have another question from mfile coding when I try to get the Fourier Transform in mfile. In below code:
I do not know why for "fshift" I do not multiply coefficient 2, the output plot shows me exactly the half frenquency that I expect (half of 15,20). Just when I mulply it by 2, it gives me (20, 15) in output.!
If any person knows the answer, please let me know.
Thank you
clc;
clear all;
close all;
V=10^-2;
W=2*10^-2;
% [a,b]=ss2tf(-0.00124,6.49,0.000092,0)
% G=tf(a,b);
s=tf('s');
G=ss(0.00059/(s+0.00124));
figure(1)
subplot(2,1,1)
step(G)
subplot(2,1,2)
bode(G)
%C=tf([0.6 0.924 0.00148],[1 0.033 0])
C=ss(0.6*s^2+0.924*s+0.00148)/(s^2+0.033*s);
T=feedback(G,C)
H=tf(T)
T1=feedback(G*C,1)
H1=tf(T1)
figure(2)
subplot(2,1,1)
step(T)
stepinfo(T)
subplot(2,1,2)
bode(T)
tf=10;
t=linspace(0,tf,1000)';
v=sqrt(V)*randn(size(t));
w=sqrt(W)*randn(size(t));
x=sin(2*pi*20*t)+sin(2*pi*15*t);
r=0.00003*ones(size(t));
y=lsim(T1,r,t)+lsim(T,v,t)+lsim(T,x,t);
y1 = fft(y)
n = length(y);
fshift = 2.*(-n/2:n/2-1)*(50/n);
yshift = fftshift(y1);
figure(3)
plot(fshift,abs(yshift))

Antworten (1)

Guru Mohanty
Guru Mohanty am 13 Jan. 2020
Hi, I simulated your Simulink design. Here is a working solution to the issue, instead of using “Vector Scope” try “Scope” Block of Simulink Library.
test_sim.png

Produkte


Version

R2014b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by