MATLAB Answers

How implement output constraints based on function with parameters from lsqcurvefit?

4 views (last 30 days)
Kamil Jasinski
Kamil Jasinski on 26 Nov 2019
I have some circuit that i need to optimize and looks like sin wave. I use lsqcurvefit to optimize my circuit as close to sin wave. This part is actually pretty easy:
[m,N] = size(xdata);
tt=linspace(0,5,N);
yfun=@(t)sin(2*pi*t-pi/2);
yy=yfun(tt);
ratmodel=@(x,tt)sin_sim_function(x);
[xopt,fv,res,ex,out,lambda,Jac]=lsqcurvefit(ratmodel,x0,tt,yy,[0,0,0,0,0],[],opts);
I need to draw someting like sin wav based on x0 after optimaliation but I need in this polt that thd(Total harmonic distortion - so actually a function) that will be less than 1. So in short - after optimazation I need to check that my output meet my constraints based on function - if not try again.
Can you help me with this one?

  0 Comments

Sign in to comment.

Answers (0)

Sign in to answer this question.