Issues with undefined variables in curve fitting

1 visualización (últimos 30 días)
Cameron Brooks
Cameron Brooks el 28 de Mzo. de 2022
Editada: Torsten el 28 de Mzo. de 2022
Hi I'm new to MATLAB and I'm trying to curve fit some data based on the theoretical model to find the various parameters of the electrical component. I keep getting:
>> Formal_Report_Curve_Fitting
Unrecognized function or variable 'Isf'.
Error in Formal_Report_Curve_Fitting (line 13)
p = [Isf,Isr,Bf,Br];
From the following script:
data = readmatrix("RAW_Zener_Diode_I-V_Data.xlsx") ;
vD = data(:,1);
iD = data(:,2);
plot(vD, iD, "*");
double Isf;
double Isr;
double Bf;
double Br;
zener_response = @(p,vD)(p(1).*(exp(p(3).* vD)-1) - p(2).*(exp(-p(4).*vD) - 1));
p = [Isf,Isr,Bf,Br];
Isf_guess = 70/1000;
Isr_guess = 20/1000;
Bf_guess = ((25/1000)*(1))^-1;
Br_guess = ((25/1000)*(2))^-1;
p0 = [Isf_guess, Isr_guess, Bf_guess, Br_guess];
p1 = lsqcurvefit(zener_response, p0, vD, iD);
iDfit = zener_response(p1, vD);
plot(vD, iD, vD, iDfit);

Respuestas (1)

Torsten
Torsten el 28 de Mzo. de 2022
data = readmatrix("RAW_Zener_Diode_I-V_Data.xlsx") ;
vD = data(:,1);
iD = data(:,2);
zener_response = @(p,vD)(p(1).*(exp(p(3).* vD)-1) - p(2).*(exp(-p(4).*vD) - 1));
Isf_guess = 70/1000;
Isr_guess = 20/1000;
Bf_guess = ((25/1000)*(1))^-1;
Br_guess = ((25/1000)*(2))^-1;
p0 = [Isf_guess, Isr_guess, Bf_guess, Br_guess];
p1 = lsqcurvefit(zener_response, p0, vD, iD);
iDfit = zener_response(p1, vD);
plot(vD, iD, vD, iDfit);

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by