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

  • SEARCH
  • Home
  • 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 8447135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:06:40+00:00 2026-06-10T10:06:40+00:00

I would like to create a function that finds the parameters p and q

  • 0

I would like to create a function that finds the parameters p and q of Bass diffusion model, given the data of two time periods.

The model (equation) is the following:

n(T) = p*m + (q-p)*n(T-1) + q/m*n(T-1)^2

where

n(T) = number of addoptions occuring in period T
n(T-1) = number of cumulative adoptions that occured before T
p = coefficient of innovation
q = coefficient of imitation
m = number of eventual adopters

for example if m = 3.000.000
and the data for the years below is the following:

2000: n(T) = 820, n(T-1) = 0
2005: n(T) = 25000, n(T-1) = 18000

then the following equation system has to be solved (in order to determine the values of p and q):

p*m + (q-p)*0 + q/3.000.000 * 0^2 == 820
p*m + (q-p)*18000 + q/3.000.000 * 18000^2 == 25000

By following Matlab documentation I tried to create a function Bass:

function F = Bass(m, p, q, cummulativeAdoptersBefore)

F = [p*m + (q-p)*cummulativeAdoptersBefore(1) + q/m*cummulativeAdoptersBefore(1).^2;
    p*m + (q-p)*cummulativeAdoptersBefore(2) + q/m*cummulativeAdoptersBefore(2).^2];


end

Which should be used in fsolve(@Bass,x0,options) but in this case m, p, q, cummulativeAdoptersBefore(1), and cummulativeAdoptersBefore(2) should be given in x0 and all variables would be considered as unknown instead of just the latter two.

Does anyone know how to solve the system of equations such as above?

Thank you!

  • 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-10T10:06:42+00:00Added an answer on June 10, 2026 at 10:06 am

    fsolve() seeks to minimize the function you supply as argument. Thus, you have to change your equations to

    p*m + (q-p)*0     + q/3.000.000 * 0^2     - 820   == 0
    p*m + (q-p)*18000 + q/3.000.000 * 18000^2 - 25000 == 0
    

    and in Matlab syntax

    function F = Bass(m, p, q, cumulativeAdoptersBefore, cumulativeAdoptersAfter)
    
        F = [p*m + (q-p)*cumulativeAdoptersBefore(1) ...
                 + q/m  *cumulativeAdoptersBefore(1).^2 
                 - cumulativeAdoptersAfter(1);
             p*m + (q-p)*cumulativeAdoptersBefore(2) ...
                 + q/m  *cumulativeAdoptersBefore(2).^2 
                 - cumulativeAdoptersAfter(2)];
    end
    

    Note: There is a typo in your Bass function (multiplication instead of sum).

    Now you have a function, which takes more parameters than there are unkowns.
    One option is to create an anonymous function, which only takes the unknowns as arguments and to fix the other parameters via a closure.
    To fit the unkowns p and q, you could use something like

    cumulativeAdoptersBefore = [0, 1800];
    cumulativeAdoptersAfter = [820, 25000];
    m = 3e6;
    x = [0, 0]; %# Probably, this is no good starting guess.
    xopt = fsolve(@(x) Bass(m, x(1), x(2), cumulativeAdoptersBefore, cumulativeAdoptersAfter), x0);
    

    So fsolve() sees a function taking only a single argument (a vector with two elements) and it also returns a vector value.

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

Sidebar

Related Questions

I would like to create a function that can deal with an object that
I would like to create a function that will return list of type that
I would like to create a function that checks if a numeric value passed
I would like to create an auto increment function that allows me to maintain
I would like to know how to create a php function that can be
I would like to write a function that creates a plot of a set
I would like to get a reference back to the function that created an
I would like to create some sort of function where you pass in a
I have a cell array of anonymous function handles, and would like to create
I'm trying to use the header() function to create a redirect. I would like

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.