Professional Documents
Culture Documents
W&MC Lab No-1
W&MC Lab No-1
SOLUTION:
QUESTION NO-1:
SOLUTION:
MATLAB CODE:
clear all;
clc;
t = -9:0.5:9;
if (t >= 0)
y= -3*(t.^2)+5;
else
y= (3*(t.^2))+5;
end
plot(t,y)
OUTPUT:
MATLAB CODE:
clc;
clear all;
t = -9:0.5:9;
m = (t>=0).*((-3*t.^2)+5);
n = (t<0).*((3*t.^2)+5);
y = m+n;
plot(y)
OUTPUT:
QUESTION NO-2:
SOLUTION:
MATLAB CODE:
clear all;
clc;
t = 0:pi/10:6*pi;
y= sin(t);
plot(t,y)
OUTPUT:
MATLAB CODE:
clear all;
clc;
t = 0:pi/10:6*pi;
y= sin(t);
plot(t,y)
%hold all
for t= -6*pi:pi/10:6*pi
if (t >= 0)
y= sin(t);
else
y= 0;
end
stem(t,y)
hold all
end
OUTPUT:
QUESTION NO-3:
SOLUTION:
MATLAB CODE:
clc;
clear all;
x = [10,5,2,5];
n = length(x);
rms = ((sum(x.^2))/n)^(1/2);
rms;
OUTPUT:
QUESTION NO-4:
SOLUTION:
I. SIGNAL GENERATOR BLOCK:
The SIGNAL GENERATOR BLOCK can produce one of four different waveforms:
SINE
SQUARE
SAWTOOTH
RANDOM
You can express signal parameters in hertz or radians per second by using its default parameter
values.
SIMULINK MODEL:
CONCLUSION: