Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i wanna to use if else statement to give output discrete or continous...but it d

ID: 1924137 • Letter: I

Question

i wanna to use if else statement to give output discrete or continous...but it does not work...

actually i want to give input and then matlab should ask the user to take output convolved graph as discrete or continous

can u plz help me to complete it


the code i used


x1= input('Please enter the signal: ') ;
h1 = input('Please enter 1st the impulse response: ');

y = conv(x1,h1) ;
n=0:(length(y)-1);
reply = input('want discrete or continous output ? D/C [D]: ', 's');
if isempty(reply)
reply = 'D';
stem(n,y)
else
reply = 'C';
plot(n,y)
end

Explanation / Answer

try like it x1= input('Please enter the signal: ') ; h1 = input('Please enter 1st the impulse response: '); y = conv(x1,h1) ; n=0:(length(y)-1); reply = input('want discrete or continous output ? D/C [D]: ', 's'); if reply == 'D'; stem(n,y); else reply = 'C'; plot(n,y) end hopefully will help u