embbed function simulink with signal
Mostrar comentarios más antiguos
Hi, I am trying to simulate the signal by Embedded matlab function in sumulink. The function has two input T=10e-6,B=30e6 and one output. The code as below
function y = chirp_gen1(T,B) %#codegen coder.extrinsic('plot');
K=B/T; %chirp slope Fs=10*B;Ts=1/Fs; %sampling frequency and sample spacing N=T/Ts; t=linspace(-T/2,T/2,N); y=exp(1j*pi*K*t.^2); %chirp signal %y=real(St);
plot(t*1e6,real(y),'-+');
If I run in matlab editor the program works fine. But if I run in simulink, it alway shows N is not constant "The number of points N must be a constant", t is "Undefined function or variable 't'. The first assignment to a local variable determines its class". So I went to change N =1000, the function will plot the signal. But if I connect to the scope. It does not show the signal as it is. I think some things relate to continuous of 't'. So, What wrong with the code above and how to get the output 'y' can connect to the scope in simulink block? Thanks
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Scopes and Data Logging en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!