i don't know how to use lsqcurvefit in this case

1 view (last 30 days)
Hi everyone,
so these is my problem:
let suppose i have this equation Y=P*(a*x+b)
i have a data vector for x let's say x=[1 2 3 4 5 6 7 8 9] , and the initial value of P let'sz say P=5, and i need to find the the value of a and b that minimise the squared error between my function and another vector (Not an Y vector) with the function LSQCURVEFIT.
this is how my algorithm should work, my LSQCURVEFIT should give me a value for 'a' and 'b' and with those value i have to calculate the ydata for all the value of 'x'
i'll take the last value of Y and i should stock it in a new vector let's name it 'ANA'. the last value of my ydata will replace the value of my 'P' and then i should do the same calucation for 20 times for exemple (so we will use a for loop)
so in final i have to compare the value of thisvector (20 number) with an experminetal data that have also 20 number
how should i procceed , if you need more explanation i'm here

Answers (0)

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!