Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8725323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:00:59+00:00 2026-06-13T08:00:59+00:00

I have a 1000×2 data file that I’m using for this problem. I am

  • 0

I have a 1000×2 data file that I’m using for this problem.

I am supposed to fit the data with Acos(wt + phi). t is time, which is the first column in the data file, i.e. the independent variable. I need to find the fit parameters (A, f, and phi) and their uncertainties.

My code is as follows:

%load initial data file
data = load('hw_fit_cos_problem.dat');
t = data(:,1); %1st column is t (time)
x = t;
y = data(:,2); %2nd column is y (signal strength)

%define fitting function
f = fittype('A*cos(w*x + p)','coefficients','A','problem',{'w','p'});

% check fit parameters
coeffs = coeffnames(f);

%fit data
[A] = fit(x,y,f)

disp('confidence interval/errorbars');
ci = confint(A) 

which yields 4 different error messages that I don’t understand.

Error Messages:

Error using fit>iAssertNumProblemParameters (line 1113)
Missing problem parameters. Specify the values as a cell array with one element for each problem parameter
in the fittype.

Error in fit>iFit (line 198)
iAssertNumProblemParameters( probparams, probnames( model ) );

Error in fit (line 109)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, …

Error in problem2 (line 14)
[A] = fit(x,y,f)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:01:00+00:00Added an answer on June 13, 2026 at 8:01 am

    The line of code

    f = fittype('A*cos(w*x + p)','coefficients','A','problem',{'w','p'});
    

    specifies A as a “coefficient” in the model, and the values w and p as “problem” parameters.

    Thus, the fitting toolbox expects that you will provide some more information about w and p, and then it will vary A. When no further information about w and p was provided to the fitting tool, that resulted in an error.

    I am not sure of the goal of this project, or why w and p were designated as problem parameters. However, one simple solution is to allow the toolbox to treat A, w, and p as “coefficients”, as follows:

    f = fittype('A*cos(w*x + p)','coefficients', {'A', 'w', 'p'});
    

    In this case, the code will not throw an error, and will return 95% confidence intervals on A, w, and p.

    I hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to generate some test data. Say I have 1000 appointments that
I have 1000 rows of data but need to only display 100 rows at
We have 1000 threads that hit a web service and time how long the
I am running an import that will have 1000's of records on each run.
Regarding iPhone Map Kit cluster pinpoints: I have 1000's of marks that I want
Lets imagine my situation (it's fake, of course)... I have web-site that have 1000
Below is the code that I now have. This gives me a 2 dimensional
i have an small issue with the way this problem is resolved. some would
I have big project that contain more than 1000 files. Everything is good if
Let's say that I have one app that have 1000 concurrent users. What's the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.