SlideShare a Scribd company logo
Experiment No.-1
OBJECT- To Draw an Ellipse,Parabola,Hyperbola and Circle
Syntax for circle
clear all
clc
r=5
theta=(1:1:360)
x=r*cosd(theta)
y=r*sind(theta)
plot(x,y)
Figure of circle
Syntax for straight Line
clear all
clc
x=(1:1:10)
y=5*x+4
plot(x,y)
Figure
Syntax for distance between two coordinate points
clear all
clc
x1=input('enter the value of x1:n')
x2=input('enter the value of x2:n')
y1=input('enter the value of y1:n')
y2=input('enter the value of y2:n')
d=sqrt(((x2.^2)-(x1.^2))+(y2.^2)-(y1.^2))
it can be run in this manner
enter the value of x1:
5
x1 =5
enter the value of x2:
4
x2 =4
enter the value of y1:
8
y1 =8
enter the value of y2:
9
y2 =9
d = 2.8284
Syntax For Parabola
clear all
clc
a=5
x=(1:1:10)
y=(4*a*x).^(1/2)
plot(x,y)
Figure
Syntax for parabola
clear cll
clc
a=7
y=(1:1:20)
x=(4*a*y).^(1/2)
plot(x,y)
Syntax for Hyperbola
clear all
clc
a=22
b=15
y=[0:1:40]
x=(b/a)*((y.^2-(a.^2)).^(1/2))
plot(x,y)
figure
EXPERIMENT NO.-3
OBJECT-To find the factorial of a user defined number
Syntax of the programme
clc
clear all
n=input('input the number/n');
factorial=1;
for i=1:n
factorial=factorial*i;
end
fprintf('factorial of %d is:%dn',n,factorial)
When we run it, it will show
input the number/n
e.g. input the number/n5
factorial of 5 is:120
Experiment no.-5
Object-to find the value of pi using Monte Carlo method
clear all
clc
r=1
M=0;N=0;
for i=1:20000
x=rand(1);
y=rand(1);
Y2=(1-x^2)^0.5
if Y2<y
N=N+1
else
M=M+1
end
end
display('value found by MONTE CARLO SIMULATION')
pi=4*M/(M+N)
Experiment No.-
OBJETC
simulation of random walk problem of the drunkard man with the
the help of random numbers
clc
clear all
n=1;
x=[];
y=[];
x(n)=0
y(n)=0
for n=1:9000
r=round(100*rand(1))
if r==100
r=r-1
end
if r>=00 && r<=47
x(n+1)=x(n);
y(n+1)=y(n)+1;
continue
end
if r>=47 && r<=72
x(n+1)=x(n)+1;
y(n+1)=y(n);
continue
end
if r>=73 && r<=97
x(n+1)=x(n)-1;
y(n+1)=y(n);
continue
end
if r>=98 && r<=99
x(n+1)=x(n);
y(n+1)=y(n)-1;
continue
end
end
plot(x,y)
Matlab file

More Related Content

PDF
10CSL67 CG LAB PROGRAM 9
PDF
easy elliptic curve(椭圆曲线算法解释)
DOCX
PPTX
Sketching derivatives
PDF
10CSL67 CG LAB PROGRAM 4
DOCX
Computer Graphics Lab File C Programs
DOC
Computer graphics
PDF
Lesson 1 Feb 10 2010
10CSL67 CG LAB PROGRAM 9
easy elliptic curve(椭圆曲线算法解释)
Sketching derivatives
10CSL67 CG LAB PROGRAM 4
Computer Graphics Lab File C Programs
Computer graphics
Lesson 1 Feb 10 2010

What's hot (19)

PPT
Intro to scan conversion
PDF
Equation plane
DOCX
Cg my own programs
PPT
Circles
PDF
Basics of Computer graphics lab
PDF
Polar plots with R
PPTX
Lec05 circle ellipse
PPT
Midpoint circle algo
PPTX
Bressenham’s Midpoint Circle Drawing Algorithm
DOCX
maths Individual assignment on differentiation
PPTX
Comuter graphics bresenhams circle drawing algorithm
DOC
Revision test 1
PDF
Sheet 1
PDF
Computer graphics lab manual
DOCX
Ninth grade 4th period study guide key
PPTX
Reed Solomon encoder and decoder \ ريد سلمون
PDF
MATHS SYMBOLS - PROPERTIES of EXPONENTS
DOCX
Wap in c to draw a line using DDA algorithm
PPTX
Computer graphics
Intro to scan conversion
Equation plane
Cg my own programs
Circles
Basics of Computer graphics lab
Polar plots with R
Lec05 circle ellipse
Midpoint circle algo
Bressenham’s Midpoint Circle Drawing Algorithm
maths Individual assignment on differentiation
Comuter graphics bresenhams circle drawing algorithm
Revision test 1
Sheet 1
Computer graphics lab manual
Ninth grade 4th period study guide key
Reed Solomon encoder and decoder \ ريد سلمون
MATHS SYMBOLS - PROPERTIES of EXPONENTS
Wap in c to draw a line using DDA algorithm
Computer graphics
Ad

Similar to Matlab file (20)

PDF
Practical File waale code.pdf
DOCX
Computer graphics
DOCX
Basic python laboratoty_ PSPP Manual .docx
DOC
Md university cmis 102 week 4 hands on lab new
DOC
Md university cmis 102 week 4 hands on lab new
DOC
Md university cmis 102 week 4 hands on lab new
DOC
Scientific calculator in c
DOCX
Mech nacp lab
PDF
Matlab assignment
PPTX
โปรแกรมย่อยและฟังชันก์มาตรฐาน
PPT
03-fortran.ppt
PDF
Matlab_basic2013_1.pdf
PDF
Practice Exercise Set 1
DOC
Lab manualsahu[et&amp;t]
DOCX
ภาษา C โปรแกรมย่อยและฟังก์ชันมาตรฐาน
DOC
Computer graphics
DOCX
More instructions for the lab write-up1) You are not obli.docx
DOCX
Computer graphics lab assignment
PPTX
Csci101 lect08a matlab_programs
DOCX
Computer graphics
Practical File waale code.pdf
Computer graphics
Basic python laboratoty_ PSPP Manual .docx
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
Scientific calculator in c
Mech nacp lab
Matlab assignment
โปรแกรมย่อยและฟังชันก์มาตรฐาน
03-fortran.ppt
Matlab_basic2013_1.pdf
Practice Exercise Set 1
Lab manualsahu[et&amp;t]
ภาษา C โปรแกรมย่อยและฟังก์ชันมาตรฐาน
Computer graphics
More instructions for the lab write-up1) You are not obli.docx
Computer graphics lab assignment
Csci101 lect08a matlab_programs
Computer graphics
Ad

More from rampal singh (20)

PPTX
Blackodising process
PDF
Schimidt hartman boiler
PDF
Velox boiler
PDF
Dual cycle
PPTX
Surface grinding machine
PPTX
Nickel electroplating
PPTX
Bloom, billet, slab, plate
PPTX
Lapping process
PPTX
Injection moulding
PPTX
Mechanism of gear shaping
PPTX
Mechanical press
PPTX
advantages of Hard chrome electroplating
PPTX
Drill machine
PDF
Properties of fluids
PDF
Lecture on quality
PDF
Emissions in engines
PDF
Open channel flow
PDF
Zenith carburetor
PPTX
Engine performance
PDF
Fuel injection system in ci engine
Blackodising process
Schimidt hartman boiler
Velox boiler
Dual cycle
Surface grinding machine
Nickel electroplating
Bloom, billet, slab, plate
Lapping process
Injection moulding
Mechanism of gear shaping
Mechanical press
advantages of Hard chrome electroplating
Drill machine
Properties of fluids
Lecture on quality
Emissions in engines
Open channel flow
Zenith carburetor
Engine performance
Fuel injection system in ci engine

Recently uploaded (20)

PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
composite construction of structures.pdf
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Construction Project Organization Group 2.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
additive manufacturing of ss316l using mig welding
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Well-logging-methods_new................
PPTX
Welding lecture in detail for understanding
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Automation-in-Manufacturing-Chapter-Introduction.pdf
bas. eng. economics group 4 presentation 1.pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
composite construction of structures.pdf
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
R24 SURVEYING LAB MANUAL for civil enggi
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Construction Project Organization Group 2.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
additive manufacturing of ss316l using mig welding
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
CYBER-CRIMES AND SECURITY A guide to understanding
Well-logging-methods_new................
Welding lecture in detail for understanding

Matlab file

  • 1. Experiment No.-1 OBJECT- To Draw an Ellipse,Parabola,Hyperbola and Circle Syntax for circle clear all clc r=5 theta=(1:1:360) x=r*cosd(theta) y=r*sind(theta) plot(x,y) Figure of circle
  • 2. Syntax for straight Line clear all clc x=(1:1:10) y=5*x+4 plot(x,y) Figure
  • 3. Syntax for distance between two coordinate points clear all clc x1=input('enter the value of x1:n') x2=input('enter the value of x2:n') y1=input('enter the value of y1:n') y2=input('enter the value of y2:n') d=sqrt(((x2.^2)-(x1.^2))+(y2.^2)-(y1.^2)) it can be run in this manner enter the value of x1: 5 x1 =5 enter the value of x2: 4 x2 =4 enter the value of y1: 8 y1 =8 enter the value of y2: 9 y2 =9 d = 2.8284
  • 4. Syntax For Parabola clear all clc a=5 x=(1:1:10) y=(4*a*x).^(1/2) plot(x,y) Figure
  • 5. Syntax for parabola clear cll clc a=7 y=(1:1:20) x=(4*a*y).^(1/2) plot(x,y)
  • 6. Syntax for Hyperbola clear all clc a=22 b=15 y=[0:1:40] x=(b/a)*((y.^2-(a.^2)).^(1/2)) plot(x,y) figure
  • 7. EXPERIMENT NO.-3 OBJECT-To find the factorial of a user defined number Syntax of the programme clc clear all n=input('input the number/n'); factorial=1; for i=1:n factorial=factorial*i; end fprintf('factorial of %d is:%dn',n,factorial) When we run it, it will show input the number/n e.g. input the number/n5 factorial of 5 is:120
  • 8. Experiment no.-5 Object-to find the value of pi using Monte Carlo method clear all clc r=1 M=0;N=0; for i=1:20000 x=rand(1); y=rand(1); Y2=(1-x^2)^0.5 if Y2<y N=N+1 else M=M+1 end end display('value found by MONTE CARLO SIMULATION') pi=4*M/(M+N)
  • 9. Experiment No.- OBJETC simulation of random walk problem of the drunkard man with the the help of random numbers clc clear all n=1; x=[]; y=[]; x(n)=0 y(n)=0 for n=1:9000 r=round(100*rand(1)) if r==100 r=r-1 end if r>=00 && r<=47 x(n+1)=x(n); y(n+1)=y(n)+1; continue end if r>=47 && r<=72 x(n+1)=x(n)+1; y(n+1)=y(n); continue end if r>=73 && r<=97 x(n+1)=x(n)-1; y(n+1)=y(n); continue end if r>=98 && r<=99 x(n+1)=x(n); y(n+1)=y(n)-1; continue end end plot(x,y)