Borrar filtros
Borrar filtros

fsolve for matrix input

3 visualizaciones (últimos 30 días)
bazrafshan88@gmail.com
bazrafshan88@gmail.com el 3 de Feb. de 2020
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.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by