Question

HELP!! In Matlab The scenario is simple: A set of (x,y) data is available in the...

HELP!!

In Matlab

The scenario is simple: A set of (x,y) data is available in the form of a simple text file – the first column represents x-values and the second column represents y-values. The task at hand is to provide the best model (or curve fit) to this set of data. Your application should provide the means to fit the following curve types to the data:

Linear (first order polynomial) of form (?? = ???? + ??) with non-zero ??-intercept

Linear (first order polynomial) of form (?? = ????) with zero ??-intercept

General polynomial of degree ??

Exponential

Power Law

Trigonometric

Logarithmic

Reciprocal

In addition, for each curve fit performed, your application should provide the Mean Square Error (MSE) between the raw data and the fitted curve. For both linear fits, your application should provide values of the coefficients of correlation R and of determination R2, as well.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

SAVE THE FOLLOWING OCDE IN MATLABA ND GET THE RESULTS-

clc

clear

close all;

%% Linear Fit

x=1:10;

y1=x+randn(1,10);

scatter(x,y1,25,'g','*')

P=polyfit(x,y1,1);

yfit=P(1)*x+P(2);

hold on;

plot(x,yfit,'r-.');

12R0

%% Exponential

f = fit(x',y1','exp1');

figure

plot(f,x,y1)

12 10 นเ 11

%% Power fit

p=polyfit(log(x),log(y1),1);

a=p(1);

k=exp(p(2));

ezplot(@(x) k*x.^a,[x(1) x(end)])

%% Reciprocal Law

a1=lsqcurvefit(@(a1,x) a1(1)./x,1,x,y1);

figure

plot(x,y1,'o') %plot data

plot(x,a1./x) %fit

28

Add a comment
Know the answer?
Add Answer to:
HELP!! In Matlab The scenario is simple: A set of (x,y) data is available in the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use matlab a) Create a simulated data set b) Create a set of plots to determine...

    Use matlab a) Create a simulated data set b) Create a set of plots to determine the best transformation to linearize the data c) Fit a first order polynomial (y mx + b) to the linearized data to find the constants m and b d) Reconstruct the original equation from m and b in the linear fitted polynomial e) Plot the fitted equation. Radioactive decay is modeled by the equation: rt where A the amount of mass as a function...

  • USING R: x variable = income, y variable = sales; data set = Carseats how would...

    USING R: x variable = income, y variable = sales; data set = Carseats how would you code this? In this part of the problem, we will find a polynomial function of Income that best fits the Carseats data. For each polynomial function between p 0,1,2,..10: i. Fit a linear regression to predict Sales as a function of Income, Income2. IncomeP (you should include an intercept as wel. Note that p 0 model is an "intercept-only" model.

  • 1)Select five-data pair (x, y) randomly yourself (not from any books, any documents etc. Form yourself!)...

    1)Select five-data pair (x, y) randomly yourself (not from any books, any documents etc. Form yourself!) and - Fit a curve with a linear equation. - Fit a curve with non-linear equation by writing the equation in a linear form. - Fit a curve with fourth-order polynomial directly. - Find fourth-order polynomial by Lagrange interpolating polynomial method. - Find fourth-order polynomial by Newton's interpolating polynomial method. Numerical methods.

  • Below are given (a) A scatterplot of Y versus X and (b) A plot of residuals...

    Below are given (a) A scatterplot of Y versus X and (b) A plot of residuals versus fitted values after a simple linear regression model was fit to the data. What is the equation of the fitted line? Discuss what is indicated about the relationship between Y and X as it relates to simple linear regression. Fitted Line Plot Y = - 14.64 + 7.431 X R-Sq R-Sq (adj) 2.43700 91.9% 91.8% 1 > 20- 3 4 5 6 7...

  • matlab matlab For this problem you will test a few interpolation approaches for the application of generating interpolated data. We'll do this by interpolating data that is sampled from a k...

    matlab matlab For this problem you will test a few interpolation approaches for the application of generating interpolated data. We'll do this by interpolating data that is sampled from a known mathematical function. The same function can then be used to compute true values at the interpolated points to use in error Consider the following mathematical function (Runge's function): 1+25r2 Write a function mfile that uses this formula to generate a set of data use those points along approaches outlined...

  • 14. Multiple Choice Variables x and y have a correlation coefficient of r = 0.89. Which...

    14. Multiple Choice Variables x and y have a correlation coefficient of r = 0.89. Which statement is best? a. There is a strong positive association between x and y and a straight line fit to the data cannot be substantially improved by fitting a curve to the data. b. There is a strong positive association between x and y and a straight line fit to the data can certainly be substantially improved by fitting a curve to the data....

  • A wind tunnel test conducted on an airfoil section yielded the following data between the lift...

    A wind tunnel test conducted on an airfoil section yielded the following data between the lift coefficient (CL) and the angle of attack (?): 12 1.40 16 1.71 20 1.38 de CL 0.11 0.55 0.95 You are required to develop a suitable polynomial relationship between ? and CL and fit a curve to the data points by the least-squares method using (a) hand calculations and (b) Matlab programming Hint: A quadratic equation (parabola) y(x)-aa,x +a x' can be used in...

  • Need help with this question on matlab. Show code please! Salmon_dat.csv 272395 286156 391573 461443 401998...

    Need help with this question on matlab. Show code please! Salmon_dat.csv 272395 286156 391573 461443 401998 313120 240763 297488 446152 480276 420555 277697 357375 331788 420879 332479 320947 359853 300917 403286 416419 345028 256049 281980 286625 278560 344422 317956 219688 259337 208197 189419 272884 360673 248860 306981 401711 867728 870035 921314 846026 570413 493708 275954 518942 480284 809799 677171 589937 1129664 1152642 Exercise 1: Salmon Runs Download the file salmon-dat.csv included with the homework. This file con- tains the annual...

  • 1. Problem 1. Given a data set (X, Y), use the least squares techniques to find the best ftting c...

    1. Problem 1. Given a data set (X, Y), use the least squares techniques to find the best ftting curve y-/() within the exponential family v ab) where a,b ER. The data set is given by, where, χ-io, 0.2, 0.4, 0.6, 08, 09, 1, 12, 14, 1.6] y 2, 2.5, 3.1, 3.9, 4.8, 5.4, 6, 7.5, 9.3, 11.6] In particular: a) Going from the original data (x,Y) set to the transformed data set (X, Z) with z(Y)-In (Y), verify that...

  • Write a function in visual basic which reads an x,y data set of unknown size and...

    Write a function in visual basic which reads an x,y data set of unknown size and at any location on the spreadsheet calculates the slope and intercept and outputs a column which contains the y values calculated from the slope and intercept.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT