0% found this document useful (0 votes)
159 views13 pages

Implementatiion of Basic Signal Processing Functions in Scilab

The document contains 11 programs demonstrating basic signal processing functions in Scilab. The programs include: 1) calculating the hypotenuse of a triangle, 2) plotting population growth, 3) generating a non-choppy function, 4) computing the Fibonacci series, 5) plotting an ellipse, 6) plotting a discrete sine wave, 7) generating and plotting an exponential sequence, 8) generating a sinusoidal signal, 9) generating a complex exponential sequence, and 10) generating unit sample, unit step, and ramp sequences. The final program 11) computes the n-point discrete Fourier transform. Sample outputs are provided for each program.

Uploaded by

sreejithkrishna4
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
159 views13 pages

Implementatiion of Basic Signal Processing Functions in Scilab

The document contains 11 programs demonstrating basic signal processing functions in Scilab. The programs include: 1) calculating the hypotenuse of a triangle, 2) plotting population growth, 3) generating a non-choppy function, 4) computing the Fibonacci series, 5) plotting an ellipse, 6) plotting a discrete sine wave, 7) generating and plotting an exponential sequence, 8) generating a sinusoidal signal, 9) generating a complex exponential sequence, and 10) generating unit sample, unit step, and ramp sequences. The final program 11) computes the n-point discrete Fourier transform. Sample outputs are provided for each program.

Uploaded by

sreejithkrishna4
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

IMPLEMENTATIION OF BASIC SIGNAL PROCESSING FUNCTIONS IN SCILAB

PROGRAM 1

//--------PROGRAM TO FIND THE HYPOTENUSE OF A TRIANGLE-------a = input("side length1 of right triangle="); b = input("side length2 of right triangle="); l = sqrt(a^2+b^2); printf("Hypotenuse=%g\n",l); SAMPLE OUTPUT: side length1 of right triangle=5 side length2 of right triangle=8 Hypotenuse=9.43398

PROGRAM 2

//------------program to plot the growth of population----//-------P(t)=197,273,000/(1+e^(.0313(t-1913.25))) clc,clear("all:close","all:") t = 1790:10:2020; p = 197273000 ./(1+exp(-0.313 .*(t-1913.25))); bar(t,p,"b"); xlabel("year"); ylabel("population"); title("growth of population")
SAMPLE OUTPUT:

PROGRAM 3:

//-----------Program to generate a non choppy function-------// f(x)=sin(1/x) // for 0.01<x<0.1 clc,clear,xdel(winsid()); x = 0.01:0.001:0.1; f = sin(1 ./x); plot(x,f,"-*"); xlabel("0.01<x<0.1"); xlim([0.01,0.1]) ylabel("f(x)"); title("f(x)=sin(1/x)");
SAMPLE OUTPUT:

PROGRAM 4:

//--------Program to compute the fibonocci series-------// f(i)=ratio of fib(n)/fib(n-1) clc,clear all; a(1) = 1; a(2) = 1; for i = 3:10 a(i) = a(i-1)+a(i-2); end; printf("first 10 fibonacci series:-\n"); printf("%d\t",a);
SAMPLE OUTPUT: first 10 fibonacci series:1 1 2 3 5 8 13 21 34 55

PROGRAM 5:

//---------------program to plot ellipse--------// r(t)=a(1-e^2)/(1-(e)cos(t)) //ae= size of the major axis //ee= eccintricity clc,clear all; t = 0:%pi/20:2*%pi; ae = 1;ee = 0.5; E = (ae .*(1-ee .^2)) ./(1-ee*cos(t)); set(gca(),"auto_clear","off") polarplot(t,E); xlabel("t"); ylabel("r(t)=a(1-e^2)/(1-(e)cos(t))"); title("ellipse");

SAMPLE OUTPUT:

PROGRAM 6:

//plot a sine wave with 100 discrete sampleswith w=0.2pi f = 1;//input frequency t = -5:0.1:5;//100 samples x = sin(((2*%pi)*f)*t); plot(t,x,"r","*");//plotting discrete samples title("Graph of the sine function"); xlabel("time"); ylabel("amplitude");

SAMPLE OUTPUT:

PROGRAM 7:

// PROGRAM TO GENERATE AND THE PLOT THE SEQUENCE% //X(n)=n.0.9.^n;-20<n<20 clc,clear all; n = -20:20; x = 0.9 .^n; disp(x); y = x .*n; disp(y); plot(n,y); xlabel("time"); ylabel("amplitude"); Title('Exponential sequence');

SAMPLE OUTPUT:

PROGRAM 8

// PROGRAM TO GENERATE A SINUSOIDAL SIGNAL //sin(t+t^2)+cos(t);0<=t<=100 clc,clear all; t = 0:0.5:100; x = sin(t+t .^2); y = cos(t); res = x+y; subplot(3,1,1); plot(t,x); title("sin(t+t^2)"); subplot(3,1,2); plot(t,y); title("cos(t)"); subplot(3,1,3); plot(t,res); title("sin(t+t^2)+cos(t)");

SAMPLE OUTPUT:

PROGRAM 9:

// Generate complex exponential sequence clc;clear all; // Get user inputs a=input('Type in real exponent='); b=input('Type in imagenary exponent='); k=input('Type in gain constant='); N=input('type in length of sequence='); // create signals c=a+b*%i;n=1:N;x=k*exp(c*n); //plot figure(0); plot2d3(n-1,real(x)); xlabel('Timeindex n'); ylabel('Amplitude'); title('Real part'); figure(1);/

plot2d3(n-1,imag(x)); xlabel('Timeindex n'); ylabel('Amplitude'); title('Imaginery part');


SAMPLE OUTPUT

PROGRAM10:

// write a program to generate the following sequence // Unit sample sequence // Unit step sequence // Ramp sequence //L=Desired length // FT=Sampling frequency inHz clc;clear all; L=input('Desired length='); FT=input('sampling frequency='); T=1/FT; n=1:L; imp=[1 zeros(1,L-1)]; step=ones(1,L); ramp=(n-1).*step; //plot f=figure(0); plot2d3(n-1,imp); xlabel('Time'); ylabel('Amplitude'); figure(1); plot2d3(n-1,step); xlabel('Time'); ylabel('Amplitude'); figure(2); plot2d3(n-1,ramp); xlabel('Time'); ylabel('Amplitude');

SAMPLE OUTPUT: Desired length=10 sampling frequency=1000

PROGRAM11

// program to compute npoint dft clc; clear all; M=input('length of input sequence='); N=input('No of samples in DFT='); x=ones(1,M); [xf]=dft(x,-1); t=0:1:M-1; figure(0); plot2d3(t,x); title('original time domain sequence'); xlabel('Time index n'); ylabel('Amplitude'); figure(1); k=0:1:N-1; plot2d3(k,abs(xf)); title('real part of the DFT samples'); xlabel('frequency indexk'); ylabel('real part'); figure(2); plot2d3(k,atan(imag(xf),real(xf))); title('imaginary part of the DFT samples'); xlabel('frequency indexk'); ylabel('imaginary part');

SAMPLE OUTPUT

GROUP NO:6 GROUP MEMBERS: 1. KIRAN KRISHNAN 2. JACOB THOMAS 3. SOM V THOMAS 4. ANJANA SEBASTIAN 5. SUMI SIMON

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy