Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

It is MATLAB problem Question has no problem1 , but the question 2 , the code Polyfit says I am wrong in Line9, why? It

image text in transcribedimage text in transcribedimage text in transcribed

It is MATLAB problem

Question has no problem1 , but the question 2 , the code "Polyfit" says I am wrong in Line9, why?

It works in other line but seems not work in loop.

How should I edit

Here is the origin code

function k=bestFit(vector) k=123; q=curveFit(vector,2); average1=mean(diff(q)); if std(diff(q))average1 k=curveFit(vector,n-1); end if standard In MATLAB, write a function named curvefit that takes as arguments a vector containing the experimental accumulation data (collected once every 10 seconds) and an integer n representing the polynomial order, and fits a curve of the given order that most closely matches the data. You will use the polyfit function (https://www.mathworks.com/help/matlab/ref/polyfit.html) to fit an n order polynomial to the experimental accumulation data. Before calling polyfit, you must create a vector containing all the possible times based on the length of the experimental accumulation data. Times start at 0, and increase by 10 for each subsequent value. Your function should return a vector of coefficients for the specified polynomial. Submit your function below for grading. Answer. 1 function p=curvefit (vector,n) 2 a-length(vector); 3 b=(0:10:(a-1)*10); 4 x.b; 5 y=vector; 6 p=polyfit(x,y,n); 7 end Check

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

What is tracking error? AppendixLO1

Answered: 1 week ago