lsqnonlin for 2 independent variables
15 views (last 30 days)
I want to find 2 variables(x,y -> complex number) with lsqnonlin function.
For example, I have 2 equations and 2 variable DATA.
Please check and advise my code. Thank you~
F = @(x) myfun_lsq(x,y,S11,S21)
function F = myfun_lsq(x,y,S11,S21)
F = [Fc1, Fc2];
Rik on 29 Aug 2021
You should merge x and y to a single variable (i.e. a 2 element vector). That way you can do this with a single call to lsqnonlin.
And you should remove that clc, clear all, close all. You don't need it and using it is a clear indication you don't know what you want to happen. Are you opening any figures? Do you really want to reduce the performance of several functions by wiping the optimization from memory with clear all?