SAS File D-1
SAS File D-1
of
THEORY:
What is OCTAVE?
PC: Go to the "Programs" menu in the "Start" menu, open the "Octave" submenu, and
select "Octave".
In Octave, you'll find a user-friendly environment with menus, buttons, and a command
window. You can use the command window to execute commands, run programs, and
perform mathematical calculations. Octave also provides helpful functions and features
for scientific computing and graphing. It's a versatile tool for various applications.
In the Octave command window, you'll see a prompt that looks like >>. You can type your
commands immediately after this prompt. After typing the command, press <enter> to
execute it. If you need to interrupt a command that Octave is running, you can type <ctrl> +
<c>.
In Octave, the commands you type in the command window are also stored in
the Command History. To repeat a command, you can double-click on it in the
history window or use the <up arrow> at the prompt to iterate through the
previously used commands.
clc;
clear all;
t=-10:0.1:10;
%continuous unit impluse function
imp=[zeros(1,100),1,zeros(1,100)]
subplot(3,2,1)
plot(t,imp)
xlabel(‘time’)
ylabel(‘imp(t)’)
title(‘continuous unit impluse function’)
%discrete unit impluse function
n=-10:1:10;
impd=[zeros(1,10),1,zeros(1,10)]
subplot(3,2,2)
stem(n,impd)
xlabel(‘time interval’)
ylabel(‘imp[n]’)
title(‘discrete unit impluse function’)
%continous unit step function
stp=[zeros(1,100),1,zeros(1,101)]
subplot(3,2,3)
plot(t,stp)
xlabel(‘time’)
ylabel(‘stp(t)’)
title(‘continuous unit step function’)
%discrete unit step function
stpd=[zeros(1,10),1,zeros(1,11)]
subplot(3,2,4)
stem(n,stpd)
xlabel(‘time interval’)
ylabel(‘step[n]’)
title(‘discrete unit step function’)
%continous ramp function
rmp=t.*stpd
subplot(3,2,5)
plot(t,rmp)
xlabel(‘time’)
ylabel(‘ramp[n]’)
title(‘discrete ramp function’)
%discrete ramp function
rmpd=n.*stpd
subplot(3,2,6)
stem(n,rmpd)
xlabel(‘time’)
ylabel(‘ramp[n]’)
title(‘discrete ramp function’)
FIGURE:
EXPERIMENT-3
clc;
clear all;
t=0:0.1:2*pi;
a1=sin(t);
subplot(3,2,1)
plot(t,a1)
xlabel("Time")
ylabel("Amplitude")
title("Sine function")
a2=cos(t);
subplot(3,2,2)
plot(t,a2)
xlabel("Time")
ylabel("Amplitude")
title("Cosine function")
a3=tan(t);
subplot(3,2,3)
plot(t,a3)
xlabel("Time")
ylabel("Amplitude")
title("Tangent function")
a4=cot(t);
subplot(3,2,4)
plot(t,a4)
xlabel("Time")
ylabel("Amplitude")
title("Cotangent function")
a5=csc(t);
subplot(3,2,5)
plot(t,a5)
xlabel("Time")
ylabel("Amplitude")
title("Cosecant function")
a6=sec(t);
subplot(3,2,6)
plot(t,a6)
xlabel("Time")
ylabel("Amplitude")
title("Secant function")
FIGURE:
EXPERIMENT-4
% Exponential signal
y = exp(x.*t);
% Real part
real_part = real(y);
% Imaginary part
imaginary_part = imag(y);
% Phase magnitude
phase_magnitude = angle(y);
%Absolute value
absolute_value=abs(y);
subplot(3,2,2);
stem(t, imaginary_part);
title('Imaginary Part');
xlabel('Time');
ylabel('Amplitude');
subplot(3,2,3);
stem(t, real_part);
title('Real Part');
xlabel('Time');
ylabel('Amplitude');
subplot(3,2,4);
stem(t, absolute_value);
title('Absolute value');
xlabel('Time');
ylabel('Amplitude');
subplot(3,2,5);
stem(t, phase_magnitude);
title('Phase Magnitude');
xlabel('Time');
ylabel('Amplitude');
FIGURE:
EXPERIMENT-6
clc;
clear all;
i=[1,2,3];
j=[4,5,6];
m=i.*j
subplot(2,2,1)
plot(m)
xlabel('Time')
ylabel('Amplitude')
k=conv(i,j)
subplot(2,2,2)
plot(k)
xlabel('Time')
ylabel('Amplitude')
subplot(2,2,3)
stem(m)
xlabel('Time')
ylabel('Amplitude')
subplot(2,2,4)
stem(k)
xlabel('Time')
ylabel('Amplitude')
FIGURE:
EXPERIMENT-7
clc;
clear all;
x=[1,2,3,4]
subplot(2,2,1)
stem(x)
xlabel("Time")
ylabel("Amplitude")
title("X")
y=[5,6,7,8]
subplot(2,2,2)
stem(y)
xlabel("Time")
ylabel("Amplitude")
title("Y")
z=cconv(x,y)
subplot(2,2,3)
stem(z)
xlabel("Time")
ylabel("Amplitude")
title("Circular convolution of X and Y")
FIGURE: