Can anyone help this graph matlab code please?

Respuestas (1)

Sara Boznik
Sara Boznik el 14 de Ag. de 2020
Hi,
is maybe this code what are you looking for?
x=-3:0.01:3;
y=NaN(size(x));
L=x<=-2;
y(L)=0;
L=x>-2 & x<0;
y(L)=x(L)+2;
L=x>=0 & x<2;
y(L)=-x(L)+2;
L=x>=2;
y(L)=0;
subplot(2,1,1)
plot(x,y,'b')
axis([-3,3,-1,3])
xlabel 't(sec)'
ylabel 'f(t)'
x=-3:0.01:3;
y=NaN(size(x));
L=x<=-1;
y(L)=0;
L=x>-1 & x<1;
y(L)=1;
L=x>=1;
y(L)=0;
subplot(2,1,2)
plot(x,y,'r')
axis([-3,3,-1,2])
xlabel 't(sec)'
ylabel 'g(t)'
I wish that helps you and good luck.

6 comentarios

Olis Oli
Olis Oli el 14 de Ag. de 2020
İt's okey but there is no convolution signal in output
Sara Boznik
Sara Boznik el 14 de Ag. de 2020
Sorry my English is bad, I don't know what means convolution, can you describe to me what exactly do you need?
Sara Boznik
Sara Boznik el 14 de Ag. de 2020
Is this work also for Simulink? If yes, then it is easy to do it.
Olis Oli
Olis Oli el 14 de Ag. de 2020
There should be part like this :
Sara Boznik
Sara Boznik el 14 de Ag. de 2020
If you use Simulink than search for blocks step and ramp, than you have to add scope (just to see if the result is correct) and blocks to workspace that you can plot that in Matlab.
John D'Errico
John D'Errico el 15 de Ag. de 2020
Please don't do student homwrok assignments for them. This does not help the student, teaching them only they can always find some person to do their work for them.

Iniciar sesión para comentar.

Productos

Etiquetas

Preguntada:

el 14 de Ag. de 2020

Comentada:

el 15 de Ag. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by