Matlab code check for signals
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Below is the code to Write a MATLAB function (not a script!) to generate a periodic waveform of total lengthL. Each period must be a pulse of amplitudeAthat lasts a total ofMsamples followed byT−Msamples that are zero so that the overall period isT. The result should be a squarewave.
function [y_square,n]=square(A,L,M,T)
t=0:1:T-1;
y_square1=A*(t>=0 & t<M);
stem(t,y_square1);
y_square=[];
n=[];
for i=1:L/T
y_square=[y_square y_square1];
n=[n t+10*(i-1)];
end
stem(n,y_square);
end
I am not getting any results and can't figure the error.
0 comentarios
Respuestas (1)
Alan Moses
el 31 de Ag. de 2020
Editada: Alan Moses
el 31 de Ag. de 2020
Hi Jone,
The code seems to be working fine. Please ensure that you have saved the file with the same name as that of your function. If you are still facing an issue, try to change the name of the function because square function is an inbuilt function in MATLAB and there might be conflict. Do make sure that the file name and function name is the same.
Hope this helps!
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!