필터 지우기
필터 지우기

fsolve for matrix input

조회 수: 3 (최근 30일)
bazrafshan88@gmail.com
bazrafshan88@gmail.com 2020년 2월 3일
Hi everyone,
I'm trying to solve a system of nonlinear equations using fsolve where the unknows are a matrix of size 2xS (S could be any integer larger than 1). However, I am getting an error for a sample that I'm trying to solve first. Here is the function and the script:
function z = myfun(x,y)
a = [2 1 3 4];
b = [5 10 20 30];
z(1,1:length(x)) = log(x.^a)-y+b;
z(2,1:length(x)) = log(y.^a)-x+b;
main script:
clc
clear
F = @(x,y)myfun(x,y);
x0 = rand(1,4);
y0 = rand(1,4);
x = fsolve(F,[x0;y0]);
It gives me this error:
Not enough input arguments.
Error in dummyfsolve>@(x,y)myfun(x,y)
Error in fsolve (line 230)
fuser = feval(funfcn{3},x,varargin{:});
Error in dummyfsolve (line 8)
x = fsolve(F,[x0;y0]);
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
Any help on this is highly appreciated.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Multiobjective Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by