0% found this document useful (0 votes)
15 views27 pages

Kishan PSLP

This document is a lab file for a course on Probability, Statistics, and Linear Programming at Dr. Akhilesh Das Gupta Institute of Professional Studies. It includes various programming exercises using MATLAB, such as fitting distributions (Poisson, Binomial, Normal), demonstrating Bernoulli processes, and solving linear programming problems. The lab work is submitted by Kishan Kumar and includes detailed programming examples and outputs.

Uploaded by

tanmayasnora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views27 pages

Kishan PSLP

This document is a lab file for a course on Probability, Statistics, and Linear Programming at Dr. Akhilesh Das Gupta Institute of Professional Studies. It includes various programming exercises using MATLAB, such as fitting distributions (Poisson, Binomial, Normal), demonstrating Bernoulli processes, and solving linear programming problems. The lab work is submitted by Kishan Kumar and includes detailed programming examples and outputs.

Uploaded by

tanmayasnora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

DEPARTMENT OF INFORMATION

TECHNOLOGY

LAB FILE

PROBABILITY, STATISTICS & LINEAR


PROGRAMMING
BS-202

DR. AKHILESH DAS GUPTA INSTITUTE OF


PROFESSIONAL STUDIES
(NEW DELHI)

SUBMITTED BY: SUBMITTED TO:


NAME- KISHAN KUMAR MS. NISHI MAM
ENROLLMENT NO.- 08215603123
BRANCH: - IT (1st SHIFT)
INDEX

S.NO. NAME OF PROGRAMES DATES TEACHER’S


SIGN
1. INSTALLATION OF MATLAB
AND DEMONSTRATION OF
SIMPLE PROGRAMMING
CONCEPTS
2. Demonstrating Bernoulli process.
Specifically, WAP to find the
probability that in case of a
Bernoulli process,
3. FITTING OF POISSON
DISTRIBUTION FOR GIVEN
VALUE OF LAMDA
4. FITTING OF BINOMIAL
DISTRIBUTION FOR GIVEN
n(trials) & p(success)
5. Fitting of Normal Distribution
when parameters are given.
6. Program to plot exponential
distribution for various parametric
values.
7. Fitting of multiple linear
regression (MLR) curve through
given data set and testing of
goodness of fit using mean error
8. Solve LPP of three variable using
Simplex method.
9. Solve a Transportation problem of
three variables.
10. Solve an assignment problem of
three variable.
KISHAN KUMAR
08215603123
PROGRAM - 1
AIM: - INSTALLATION OF MATLAB AND DEMONSTRATION OF SIMPLE PROGRAMMING CONCEPTS LIKE
MATRIX ADDITION, SUBSTRATION, MULTIPLICATION (SCALAR AND VECTOR), LOOP,
CONDITIONAL,STATEMENT AND PLOTTING.

a = [1 23 3;1 4 6;1 5 6]

a = 3×3
1 23 3
1 4 6
1 5 6

b = [1 1 1;8 5 4;2 5 8]

b = 3×3
1 1 1
8 5 4
2 5 8

l = (a+b)

l = 3×3
2 24 4
9 9 10
3 10 14

m = (a - b)

m = 3×3
0 22 2
-7 -1 2
-1 0 -2

n = (a')

n = 3×3
1 1 1
23 4 5
3 6 6

o = (b')

o = 3×3
1 8 2
1 5 5
1 4 8

p = trace(a)

p = 11

p = 11

p = 11

q = trace(b)

q = 14

q = 14

q = 14
KISHAN KUMAR
08215603123
r = (a*b)
r = 3×3
191 131 117
45 51 65
53 56 69

% USING LOOP
a = 5;
for i =[1:5]
a
end

a = 5
a = 5
a = 5
a = 5
a = 5

sprintf('\n')

ans =
'
'

% to print power of b =3 from 1 to 5


b=3;
for i = [1:5]
c = b^i
end

c = 3
c = 9
c = 27
c = 81
c = 243

sprintf('\n')

ans =
'
'

%to print sum of first 10 natural number


sum = 0;
2

ans = 2

for i = [1:10]
sum = sum+i
end

sum = 1
sum = 3

KISHAN KUMAR
08215603123
sum = 6
sum = 10
sum = 15
sum = 21
sum = 28
sum = 36
sum = 45
sum = 55

sprintf('\n')

ans =
'
'

% Plotting
x=[0:0.1:10]

x = 1×101
0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 ⋯

y=sin(x)

y = 1×101
0 0.0998 0.1987 0.2955 0.3894 0.4794 0.5646 ⋯

g=cos(x)

g = 1×101
1.0000 0.9950 0.9801 0.9553 0.9211 0.8776 0.8253 ⋯

plot(x,y,"m--",x,g,"c")
xlabel("x")
ylabel("sin(x)/cos(x)")
title("graph bw sin x and cos x")
grid on;

KISHAN KUMAR
08215603123
PROGRAM - 2
AIM: Demonstrating Bernoulli process. Specifically, WAP to find the probability that in case of a Bernoulli
process, where.

a) out of n trials k are successes


function[]=bernoulli()
q = 0.10;
p = 1-q;
n = 6;
x = 3;
prob = nchoosek(n, x)*(p ^ x) * (q ^ (n - x));
disp(prob)
end

Bernoulli >> 0.01458

function[]=bernoulli()
q = 0.10;
p = 1-q;
n = 8;
x = 4;
prob = nchoosek(n, x)*p*(p ^ x) * (q ^ (n - x));
disp(prob)
end

Bernoulli >> 0.00413343

KISHAN KUMAR
08215603123
PROGRAM - 3
AIM- FITTING OF POISSON DISTRIBUTION FOR GIVEN VALUE OF LAMDA

1. COMPUTE PROBABILITY DISTRIBUTION FUNCTION

x=0:15;
y=poisspdf(x,4);
bar(x,y,1);
xlabel("Observation");
ylabel("Probability");

2. COMPUTE CUMULATIVE PROBABILITY DISTRIBUTION FUNCTION

stairs(x,y);
xlabel("Observation");
ylabel("Cumulative Probability");

3. COMPUTE NORMAL AND POISSON DISTRIBUTION FUNCTION

lamda=50;
x1=0:100;
y1=poisspdf(x1,lamda);
mu=lamda;
KISHAN KUMAR
08215603123
sigma=sqrt(lamda);
x2=0:0.1:100;
y2=normpdf(x2,mu,sigma);
bar(x1,y1,1)
hold on
plot(x2,y2,"LineWidth",2)
xlabel("Observation")
ylabel("Probability")
title("Poisson and Normal Pdf's")
legend("Poissson Distribution","Normal Distribution","Location","Northwest")
hold off

KISHAN KUMAR
08215603123
PROGRAM - 4
AIM: - FITTING OF BINOMIAL DISTRIBUTION FOR GIVEN n(trials) & p(success)

1. Out of n trials k are successes.

q=0.45

q = 0.4500

p=1-q

p = 0.5500

n=6

n = 6

x=3

x = 3

prob = nchoosek(n,x)*(p^x)*(q^(n-x));
disp(prob)

0.3032

2. kth success occur at nth trial

q=0.25

q = 0.2500

p=1-q

p = 0.7500

n=10

n = 10

x=4

x = 4

prob = nchoosek(n,x)*(p^x)*p*(q^(n-x));
disp(prob)

0.0122

KISHAN KUMAR
08215603123
PROGRAM - 5
AIM: - Fitting of Normal Distribution when parameters are given.

% Fit Normal Distribution Object

load examgrades
x = grades(:,1);
pd = fitdist(x,'Normal')

pd =
NormalDistribution

Normal distribution
mu = 75.0083 [73.4321, 76.5846]
sigma = 8.7202 [7.7391, 9.98843]

% Estimate Parameters

load examgrades
x = grades(:,1);
[mu,s,muci,sci] = normfit(x)

mu = 75.0083
s = 8.7202
muci = 2×1
73.4321
76.5846
sci = 2×1
7.7391
9.9884

%Compute and Plot the Normal Distribution pdf

x = [-3:.1:3];
y = normpdf(x,0,1);
plot(x,y)

%Compare Gamma and Normal Distribution pdfs


KISHAN KUMAR
08215603123
a = 100;
b = 5;
x = 250:750;
y_gam = gampdf(x,a,b);
mu = a*b

mu = 500

sigma = sqrt(a*b^2)

sigma = 50

y_norm = normpdf(x,mu,sigma);
plot(x,y_gam,'-',x,y_norm,'-.')
title('Gamma and Normal pdfs')
xlabel('Observation')
ylabel('Probability Density')
legend('Gamma Distribution','Normal Distribution')

%Relationship Between Normal and Lognormal Distributions

pd = makedist('Lognormal','mu',5,'sigma',2)

pd =
LognormalDistribution

Lognormal distribution
mu = 5
sigma = 2

mean(pd)

ans = 1.0966e+03

rng('default'); % For reproducibility


x = random(pd,10000,1);
logx = log(x);
KISHAN KUMAR
08215603123
m = mean(logx)
m = 5.0033

histfit(logx)

pd_normal = fitdist(logx,'Normal')

pd_normal =
NormalDistribution

Normal distribution
mu = 5.00332 [4.96445, 5.04219]
sigma = 1.98296 [1.95585, 2.01083]

%Compare Student's t and Normal Distribution pdfs

x = [-5:0.1:5];
y1 = tpdf(x,5);
y2 = tpdf(x,15);
z = normpdf(x,0,1);
plot(x,y1,'-.',x,y2,'--',x,z,'-')
legend('Student''s t Distribution with \nu=5', ...
'Student''s t Distribution with \nu=15', ...
'Standard Normal Distribution','Location','best')
xlabel('Observation')
ylabel('Probability Density')
title('Student''s t and Standard Normal pdfs')

KISHAN KUMAR
08215603123
KISHAN KUMAR
08215603123
PROGRAM - 6
AIM: - Program to plot exponential distribution for various parametric values.

%Fit Exponential Distribution to Data

x = exprnd(700,100,1); % Generate sample


pd = fitdist(x,'exponential')

pd =
ExponentialDistribution

Exponential distribution
mu = 671.663 [557.262, 825.504]

[muhat,muci] = expfit(x) % Distribution specific function

muhat = 671.6626
muci = 2×1
557.2625
825.5035

[muhat2,muci2] = mle(x,'distribution','exponential') % Generic distribution function

muhat2 = 671.6626
muci2 = 2×1
557.2625
825.5035

%Compute Exponential Distribution pdf

x = 0:0.1:10;
y = exppdf(x,2);
figure;
plot(x,y)
xlabel('Observation')
ylabel('Probability Density')

%Compute Exponential Distribution cdf

x = 0:0.1:10;
KISHAN KUMAR
08215603123
y = expcdf(x,2);
figure;
plot(x,y)
xlabel('Observation')
ylabel('Cumulative Probability')

%Exponentially Distributed Lifetimes

x = 1:5;
lambda1 = exppdf(x,2)./(1-expcdf(x,2))

lambda1 = 1×5
0.5000 0.5000 0.5000 0.5000 0.5000

mu = 1:5;
lambda2 = exppdf(3,mu)./(1-expcdf(3,mu))

lambda2 = 1×5
1.0000 0.5000 0.3333 0.2500 0.2000

x2 = 5:5:25;
x3 = x2 + 1;
deltap = (expcdf(x3,10)-expcdf(x2,10))./(1-expcdf(x2,10))

deltap = 1×5
0.0952 0.0952 0.0952 0.0952 0.0952

KISHAN KUMAR
08215603123
PROGRAM - 7
AIM: - Fitting of multiple linear regression (MLR) curve through given data set and testing of goodness of fit
using mean error.

% Estimate Multiple Linear Regression Coefficients


load carsmall
x1= Weight

x1 = 100×1
3504
3693
3436
3433
3449
4341
4354
4312
4425
3850

x2= Acceleration

x2 = 100×1
12.0000
11.5000
11.0000
12.0000
10.5000
10.0000
9.0000
8.5000
10.0000
8.5000

y=MPG

y = 100×1
18
15
18
16
17
15
14
14
14
15

X=[ones(size(x1)) x1 x2 x1.*x2]

X = 100×4
104 ×
0.0001 0.3504 0.0012 4.2048
0.0001 0.3693 0.0011 4.2470
0.0001 0.3436 0.0011 3.7796
0.0001 0.3433 0.0012 4.1196
0.0001 0.3449 0.0010 3.6214
0.0001 0.4341 0.0010 4.3410
0.0001 0.4354 0.0009 3.9186

KISHAN KUMAR
08215603123
0.0001 0.4312 0.0008 3.6652
0.0001 0.4425 0.0010 4.4250
0.0001 0.3850 0.0008 3.2725

b=regress(y,X)

b = 4×1
37.1906
-0.0057
0.7261
-0.0002

scatter3(x1,x2,y,"filled")
hold on
x1fit=min(x1):100:max(x1)

x1fit = 1×30
1795 1895 1995 2095 2195 2295 ⋯

x2fit=min(x2):10:max(x2)

x2fit = 1×2
8 18

[X1FIT,X2FIT]=meshgrid(x1fit,x2fit)

X1FIT = 2×30
1795 1895 1995 2095 2195 2295 ⋯
1795 1895 1995 2095 2195 2295
X2FIT = 2×30
8 8 8 8 8 8 8 8 8 8 8 8 8 ⋯
18 18 18 18 18 18 18 18 18 18 18 18 18

YFIT = b(1)+b(2)*X1FIT+b(3)*X2FIT+b(4)*X1FIT.*X2FIT

YFIT = 2×30
30.2368 29.5258 28.8148 28.1038 27.3927 26.6817 25.9707 ⋯
34.4255 33.5433 32.6611 31.7789 30.8967 30.0145 29.1324

mesh(X1FIT,X2FIT,YFIT)
xlabel("Weight")
ylabel("Acceleration")
zlabel("MPG")
view(100,20)
hold off

KISHAN KUMAR
08215603123
KISHAN KUMAR
08215603123
PROGRAM - 8
AIM: - Solve LPP of three variable using Simplex method.

% Objective Functions Coefficients


f=[-3,1,1]

f = 1×3
-3 1 1

% Inequality Constraints Coefficients


A=[1,-1,1;
2,1,1;
-1,1,2];
% Inequality Constraints Bounds
b=[2;10;5]

b = 3×1
2
10
5

% Lower & Upper bounds on the variables


lb=zeros(3,1)

lb = 3×1
0
0
0

ub=[];
% Solve the LPP using Simplex Method
[x,fval,exitflag]=linprog(f,A,b,[],[],lb,ub)

Optimal solution found.


x = 3×1
4
2
0
fval = -10
exitflag = 1

% Print the Results


disp(["Optimal solutions: x1=",num2str(x(1)),
",x2=",num2str(x(2)),",x3=",num2str(x(3))])

"Optimal solutions: x1=" "4" ",x2=" "2" ",x3=" "0"

disp(["Optimal objective function value:" num2str(-fval)])

"Optimal objective function value:" "10"

% Define the inequality constraints as planes


x1=linspace(0,5,20)

x1 = 1×20
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789 ⋯

x2=linspace(0,10,20)

x2 = 1×20
KISHAN KUMAR
08215603123
0 0.5263 1.0526 1.5789 2.1053 2.6316 3.1579 ⋯

[x1,x2]=meshgrid(x1,x2)

x1 = 20×20
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789 ⋯
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789
0 0.2632 0.5263 0.7895 1.0526 1.3158 1.5789

x2 = 20×20
0 0 0 0 0 0 0 ⋯
0.5263 0.5263 0.5263 0.5263 0.5263 0.5263 0.5263
1.0526 1.0526 1.0526 1.0526 1.0526 1.0526 1.0526
1.5789 1.5789 1.5789 1.5789 1.5789 1.5789 1.5789
2.1053 2.1053 2.1053 2.1053 2.1053 2.1053 2.1053
2.6316 2.6316 2.6316 2.6316 2.6316 2.6316 2.6316
3.1579 3.1579 3.1579 3.1579 3.1579 3.1579 3.1579
3.6842 3.6842 3.6842 3.6842 3.6842 3.6842 3.6842
4.2105 4.2105 4.2105 4.2105 4.2105 4.2105 4.2105
4.7368 4.7368 4.7368 4.7368 4.7368 4.7368 4.7368

x3=(2-x1+x2).*double(2*x1+ x2 <=10).*double(-x1+ x2+ 2*x2 <=5)

x3 = 20×20
2.0000 1.7368 1.4737 1.2105 0.9474 0.6842 0.4211 ⋯
2.5263 2.2632 2.0000 1.7368 1.4737 1.2105 0.9474
3.0526 2.7895 2.5263 2.2632 2.0000 1.7368 1.4737
3.5789 3.3158 3.0526 2.7895 2.5263 2.2632 2.0000
0 0 0 0 0 2.7895 2.5263
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

% Plot the feasible region as surface


figure;
surf(x1,x2,x3, "FaceColor","green","FaceAlpha",0.2,"EdgeColor","none")
hold on
% Plot the optimal solution as red dot
scatter3(2,0,3,100,"red","filled")
% Set the axis lables and titles
xlabel("x_1")
ylabel("x_2")
zlabel("x_3")
title("Feasible Solution & Optimal Solution")
view(-30,30)

KISHAN KUMAR
08215603123
KISHAN KUMAR
08215603123
PROGRAM - 9
AIM: - Solve a Transportation problem of three variables.

KISHAN KUMAR
08215603123
KISHAN KUMAR
08215603123
PROGRAM - 10
AIM: - Solve an assignment problem of three variable.

% Assign Flights with Minimal Cost


c=[600 670 960 560
900 280 970 540
310 350 950 820
325 290 600 540]

c = 4×4
600 670 960 560
900 280 970 540
310 350 950 820
325 290 600 540

M=matchpairs(c,1000)

M = 4×2
3 1
2 2
4 3
1 4

% Unequal numbers of rows and columns


rng default
C=randi([10 100],3,8)

C = 3×8
84 93 35 97 97 22 82 13
92 67 59 24 54 48 97 87
21 18 97 98 82 93 69 94

[M,uR,uC]=matchpairs(C,1e4)

M = 3×2
3 2
2 4
1 8
uR =

0×1 empty double column vector


uC = 5×1
1
3
5
6
7

% Track Point Positions over Time


[x,y]=meshgrid(4:6:16)

x = 3×3
4 10 16
4 10 16
4 10 16
y = 3×3
4 4 4

KISHAN KUMAR
08215603123
10 10 10
16 16 16

x0=x(:)'

x0 = 1×9
4 4 4 10 10 10 16 16 16

y0=y(:)'

y0 = 1×9
4 10 16 4 10 16 4 10 16

plot(x0,y0,"g*")
hold on
rng default
x1=x0+randn(size(x0))

x1 = 1×9
4.5377 5.8339 1.7412 10.8622 10.3188 8.6923 15.5664 ⋯

y1=y0+randn(size(y0))

y1 = 1×9
6.7694 8.6501 19.0349 4.7254 9.9369 16.7147 3.7950 ⋯

plot(x1,y1,"r*")
C=zeros(size(x).^2)

C = 9×9
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0

for k=1:length(y1)
C(k,:)=vecnorm([x1(k)-x0; y1(k)-y0],2,1)'
end

C = 9×9
2.8211 3.2750 9.2462 6.1243 6.3461 10.7257 11.7922 ⋯
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
C = 9×9
2.8211 3.2750 9.2462 6.1243 6.3461 10.7257 11.7922 ⋯
4.9987 2.2771 7.5752 6.2434 4.3794 8.4485 11.1792
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
KISHAN KUMAR
08215603123
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
C = 9×9
2.8211 3.2750 9.2462 6.1243 6.3461 10.7257 11.7922 ⋯
4.9987 2.2771 7.5752 6.2434 4.3794 8.4485 11.1792
15.2037 9.3130 3.7833 17.1539 12.2408 8.7988 20.7211
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
C = 9×9
2.8211 3.2750 9.2462 6.1243 6.3461 10.7257 11.7922 ⋯
4.9987 2.2771 7.5752 6.2434 4.3794 8.4485 11.1792
15.2037 9.3130 3.7833 17.1539 12.2408 8.7988 20.7211
6.9004 8.6551 13.1987 1.1267 5.3446 11.3075 5.1888
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
C = 9×9
2.8211 3.2750 9.2462 6.1243 6.3461 10.7257 11.7922 ⋯
4.9987 2.2771 7.5752 6.2434 4.3794 8.4485 11.1792
15.2037 9.3130 3.7833 17.1539 12.2408 8.7988 20.7211
6.9004 8.6551 13.1987 1.1267 5.3446 11.3075 5.1888
8.6703 6.3191 8.7571 5.9455 0.3249 6.0714 8.2173
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
C = 9×9
2.8211 3.2750 9.2462 6.1243 6.3461 10.7257 11.7922 ⋯
4.9987 2.2771 7.5752 6.2434 4.3794 8.4485 11.1792
15.2037 9.3130 3.7833 17.1539 12.2408 8.7988 20.7211
6.9004 8.6551 13.1987 1.1267 5.3446 11.3075 5.1888
8.6703 6.3191 8.7571 5.9455 0.3249 6.0714 8.2173
13.5530 8.1918 4.7464 12.7818 6.8409 1.4903 14.6652
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
C = 9×9
2.8211 3.2750 9.2462 6.1243 6.3461 10.7257 11.7922 ⋯
4.9987 2.2771 7.5752 6.2434 4.3794 8.4485 11.1792
15.2037 9.3130 3.7833 17.1539 12.2408 8.7988 20.7211
6.9004 8.6551 13.1987 1.1267 5.3446 11.3075 5.1888
8.6703 6.3191 8.7571 5.9455 0.3249 6.0714 8.2173
13.5530 8.1918 4.7464 12.7818 6.8409 1.4903 14.6652
11.5682 13.1257 16.8150 5.5702 8.3359 13.4144 0.4796
0 0 0 0 0 0 0
0 0 0 0 0 0 0
C = 9×9
2.8211 3.2750 9.2462 6.1243 6.3461 10.7257 11.7922 ⋯
4.9987 2.2771 7.5752 6.2434 4.3794 8.4485 11.1792
15.2037 9.3130 3.7833 17.1539 12.2408 8.7988 20.7211
6.9004 8.6551 13.1987 1.1267 5.3446 11.3075 5.1888
8.6703 6.3191 8.7571 5.9455 0.3249 6.0714 8.2173
13.5530 8.1918 4.7464 12.7818 6.8409 1.4903 14.6652
11.5682 13.1257 16.8150 5.5702 8.3359 13.4144 0.4796
13.6699 12.3432 13.7784 8.6461 6.3438 8.8167 5.8858
0 0 0 0 0 0 0
C = 9×9
KISHAN KUMAR
08215603123
2.8211 3.2750 9.2462 6.1243 6.3461 10.7257 11.7922 ⋯
4.9987 2.2771 7.5752 6.2434 4.3794 8.4485 11.1792
15.2037 9.3130 3.7833 17.1539 12.2408 8.7988 20.7211
6.9004 8.6551 13.1987 1.1267 5.3446 11.3075 5.1888
8.6703 6.3191 8.7571 5.9455 0.3249 6.0714 8.2173
13.5530 8.1918 4.7464 12.7818 6.8409 1.4903 14.6652
11.5682 13.1257 16.8150 5.5702 8.3359 13.4144 0.4796
13.6699 12.3432 13.7784 8.6461 6.3438 8.8167 5.8858
20.6072 17.2853 15.6495 16.5444 12.1590 9.6935 13.9562

M=matchpairs(C,1)

M = 5×2
4 4
5 5
6 6
7 7
8 8

xc=[x0(M(:,2));x1(M(:,1))]

xc = 2×5
10.0000 10.0000 10.0000 16.0000 16.0000
10.8622 10.3188 8.6923 15.5664 16.3426

yc=[y0(M(:,2));y1(M(:,1))]

yc = 2×5
4.0000 10.0000 16.0000 4.0000 10.0000
4.7254 9.9369 16.7147 3.7950 9.8759

plot(xc,yc,"-o")

KISHAN KUMAR
08215603123

You might also like