lsqcurvefit input question.

8 ビュー (過去 30 日間)
Sohrab Salimian
Sohrab Salimian 2020 年 1 月 29 日
コメント済み: Ganesh Regoti 2020 年 3 月 23 日
I was just wondering if it is possible, to pass into lsqcurvefit matrices of input data but then have the output y data be a vector of values. Basically is it possible to have two types of input and output data passed into the function, or do they have to be the same type.
  1 件のコメント
Ganesh Regoti
Ganesh Regoti 2020 年 3 月 23 日
Hi
I feel the question is not clear. I would like to understand
  1. By passing matrices of input data, do you mean 1-D or multi-dimensional?
  2. Output y data be vector, do you mean just 1-D?
In MATLAB, 1-D arrays are taken as vectors and multi-dimensional arrays are taken as matrices. Here is a small example with lsqcurvefit
xdata = [5 4 6]; % example xdata
ydata = 3*sin([5 4 6])+6; % example ydata
x = lsqcurvefit(@(x,xdata) x(1)*sin(xdata)+x(2),[2 7],xdata,ydata)
Based on the input data and function handler, it returns a vector as output. How you treat the input data completely depends on your function.
Hope this helps!

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by