Issues with undefined variables in curve fitting
Ältere Kommentare anzeigen
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);
Antworten (1)
Torsten
am 28 Mär. 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);
Kategorien
Mehr zu Curve Fitting Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!