Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
5 views
CF
Uploaded by
omkulkarni412
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download now
Download
Save cf For Later
Download
Save
Save cf For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
5 views
CF
Uploaded by
omkulkarni412
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download now
Download
Save cf For Later
Carousel Previous
Carousel Next
Save
Save cf For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 1
Search
Fullscreen
% Input Section - Taking sample data from the user
n = input('Enter the number of data points: ');
x = zeros(1, n);
y = zeros(1, n);
disp('Enter the sample data (x, y):');
for i = 1:n
x(i) = input(['Enter x' num2str(i) ': ']);
y(i) = input(['Enter y' num2str(i) ': ']);
end
% Degree of the polynomial
degree = 2;
% Creating the Vandermonde matrix
A = zeros(length(x), degree + 1);
for i = 1:length(x)
for j = 1:(degree + 1)
A(i, j) = x(i)^(j - 1);
end
end
% Solving the least squares problem
coefficients = (A' * A) \ (A' * y');
% Generating the fitted curve
x_fit = linspace(min(x), max(x), 100);
y_fit = zeros(size(x_fit));
for i = 1:(degree + 1)
y_fit = y_fit + coefficients(i) * x_fit.^(i - 1);
end
% Plotting the data and the fitted curve
plot(x, y, 'o', x_fit, y_fit, '-');
xlabel('x');
ylabel('y');
title('Curve Fitting using Least Squares Method');
legend('Data', 'Fitted Curve');
grid on;
You might also like
Scilab Code For Implementing LMS Algorithm (Function) For P 2
PDF
No ratings yet
Scilab Code For Implementing LMS Algorithm (Function) For P 2
7 pages
CONM Lab Manual
PDF
No ratings yet
CONM Lab Manual
11 pages
Assignment 2
PDF
No ratings yet
Assignment 2
12 pages
indexamc_merged
PDF
No ratings yet
indexamc_merged
16 pages
Matlab Coooode
PDF
No ratings yet
Matlab Coooode
5 pages
Matlab Code
PDF
No ratings yet
Matlab Code
23 pages
% Matlab Program To Fit Straight Line/first Degree Curve (Y Ax+b)
PDF
No ratings yet
% Matlab Program To Fit Straight Line/first Degree Curve (Y Ax+b)
5 pages
Answer PDF
PDF
No ratings yet
Answer PDF
4 pages
Department of Metallurgical Engineering and Materials Science, IIT Bombay
PDF
No ratings yet
Department of Metallurgical Engineering and Materials Science, IIT Bombay
5 pages
1) - Lagrange Polynomial Interpolation: N 3
PDF
No ratings yet
1) - Lagrange Polynomial Interpolation: N 3
16 pages
Week 9: Polynomial Interpolation and Least Squares Fitting
PDF
No ratings yet
Week 9: Polynomial Interpolation and Least Squares Fitting
4 pages
Exponential Fit
PDF
No ratings yet
Exponential Fit
3 pages
Curve Fitting Least Square Fit Method: Sandeep Kumar
PDF
No ratings yet
Curve Fitting Least Square Fit Method: Sandeep Kumar
27 pages
Module 2 Lab Activity - Regression
PDF
No ratings yet
Module 2 Lab Activity - Regression
9 pages
LMSP
PDF
No ratings yet
LMSP
7 pages
Lampiran A. Source Code Program: Universitas Sumatera Utara
PDF
No ratings yet
Lampiran A. Source Code Program: Universitas Sumatera Utara
7 pages
MP5 Ceit 04 501a 1a 3
PDF
No ratings yet
MP5 Ceit 04 501a 1a 3
10 pages
'Enter First Value: ': 1 % Initialize Sums. % Read in First Value % While Loop To Read Input Values. % Accumulate Sums
PDF
No ratings yet
'Enter First Value: ': 1 % Initialize Sums. % Read in First Value % While Loop To Read Input Values. % Accumulate Sums
16 pages
Pinv for Modern ML
PDF
No ratings yet
Pinv for Modern ML
31 pages
numerical Analysis report. Togola Molobaly Dit Bébé. 202352180026
PDF
No ratings yet
numerical Analysis report. Togola Molobaly Dit Bébé. 202352180026
13 pages
EE 553 Homeworks Moyo
PDF
No ratings yet
EE 553 Homeworks Moyo
27 pages
Chapter6_Prob22
PDF
No ratings yet
Chapter6_Prob22
3 pages
PB36 Lab6
PDF
No ratings yet
PB36 Lab6
2 pages
To Implement Curve Fitting Using Least Squares Curve Fitting Method
PDF
No ratings yet
To Implement Curve Fitting Using Least Squares Curve Fitting Method
6 pages
MAE 502 Prob Set 3
PDF
No ratings yet
MAE 502 Prob Set 3
8 pages
Mat523 Mini Project PDF
PDF
No ratings yet
Mat523 Mini Project PDF
37 pages
HW3 Least Squares
PDF
No ratings yet
HW3 Least Squares
1 page
Curve Fitting With Scilab
PDF
No ratings yet
Curve Fitting With Scilab
8 pages
Assignment 3
PDF
No ratings yet
Assignment 3
9 pages
a1.2
PDF
No ratings yet
a1.2
3 pages
MP Matlab Codes
PDF
No ratings yet
MP Matlab Codes
6 pages
LABORATORY 3- BUCONG OMALAY CASIMINA SABILLO IREMEDIO (NOT FINAL)
PDF
No ratings yet
LABORATORY 3- BUCONG OMALAY CASIMINA SABILLO IREMEDIO (NOT FINAL)
10 pages
Mat167 PDF
PDF
No ratings yet
Mat167 PDF
6 pages
Numerical Methods in Structural Engineering (Ce60125) :computer Assignment 1
PDF
No ratings yet
Numerical Methods in Structural Engineering (Ce60125) :computer Assignment 1
7 pages
Labtask1: Generatedataset
PDF
No ratings yet
Labtask1: Generatedataset
12 pages
CF problem (1)
PDF
No ratings yet
CF problem (1)
5 pages
LU
PDF
No ratings yet
LU
1 page
Matlab-Ex (Chp#6) .
PDF
No ratings yet
Matlab-Ex (Chp#6) .
16 pages
Week 1
PDF
No ratings yet
Week 1
13 pages
NMO codes ALL
PDF
No ratings yet
NMO codes ALL
25 pages
nmaee_exp7_reg
PDF
No ratings yet
nmaee_exp7_reg
6 pages
Experiment-5: AIM:WAP in MATLAB To Find The Root of Following Equations Using Gauss Elimination
PDF
No ratings yet
Experiment-5: AIM:WAP in MATLAB To Find The Root of Following Equations Using Gauss Elimination
26 pages
Homework 1
PDF
No ratings yet
Homework 1
8 pages
For The Function
PDF
No ratings yet
For The Function
6 pages
Numerical Method For Engineering 3
PDF
No ratings yet
Numerical Method For Engineering 3
9 pages
Kilian 2009 Code
PDF
No ratings yet
Kilian 2009 Code
25 pages
Numerical Methods Project
PDF
No ratings yet
Numerical Methods Project
26 pages
Regressions in Matlab
PDF
No ratings yet
Regressions in Matlab
2 pages
F.Y Engg Grap
PDF
No ratings yet
F.Y Engg Grap
17 pages
Regressions in Matlab
PDF
No ratings yet
Regressions in Matlab
2 pages
Datos: %entrenamiento %validación %test
PDF
No ratings yet
Datos: %entrenamiento %validación %test
16 pages
24MIC7221_M.Bhavani Prasad
PDF
No ratings yet
24MIC7221_M.Bhavani Prasad
24 pages
2023 Spring ML HW01
PDF
No ratings yet
2023 Spring ML HW01
5 pages
a2_220932
PDF
No ratings yet
a2_220932
4 pages
D/17/CE/105 CE 6151: Computational Methods in Civil Engineering Tutorial Sheet-2: MATLAB PROGRAM
PDF
No ratings yet
D/17/CE/105 CE 6151: Computational Methods in Civil Engineering Tutorial Sheet-2: MATLAB PROGRAM
21 pages
AMC3
PDF
No ratings yet
AMC3
8 pages
BY_Abdullah Hassan Damad
PDF
No ratings yet
BY_Abdullah Hassan Damad
24 pages
NMO_FINAL_PROGRAMS
PDF
No ratings yet
NMO_FINAL_PROGRAMS
16 pages
Lab1_202301195
PDF
No ratings yet
Lab1_202301195
3 pages
C Language Programming Codes
From Everand
C Language Programming Codes
Durgesh
No ratings yet
Documents
Computers