Hi everyone, thanks in advance for any help or tip you will give me.
I have a problem about solving a system of 2 nonlinear equation of 2 variables and 1 parameters, the one which would change during every iteraction (I tried to search in other questions opened before mine but it seems i couldn't find anything relatable or solvable for my case).
The problem at the beginning of my matlab code is to find self-consistent solutions of a a system of 2 nonlin. equation in 2 variables, but one of these equations with a parameter that is the components of a given vector V. The result i need is a matrix with the 2 solutions in the rows, and column based on V dimension.
My thought was to use this kind of code, but i dont understand the source of the error "Unable to perform assignment because dot indexing is not supported for variables of this type.".
Am i just using a bad code, or what i need is not solvable by fsolve, and i need another approach?
(Sorry for any mistake, english in not my mother tongue)
Code:
function F(Cq,Vch,V) %%variables are Cq and Vch, V should be the parameter
%%...
%%constants definitions
%%..
F(1)= Cq-(K*kB*T)*log(2*(1+cosh((q*Vch))/(kB*T)))); F(2)= Vch -(Vgstop-V)*(Cox/(Cox+0.5*Cq));end%%different file
%...
% constant definitions
%...V=-1:0.01:1; %%vector of parameters
Cq0=0; %initial guess
Vch0=0; %initial guessfor i=1:length(V) iterfun=@(Cq,Vch) F(Cq,Vch,V(i)}); ans(i,:)=fsolve(iterfun,Cq0,Vch0);end
Best Answer