Issues with undefined variables in curve fitting

조회 수: 2 (최근 30일)
Cameron Brooks
Cameron Brooks 2022년 3월 28일
편집: Torsten 2022년 3월 28일
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);

답변 (1개)

Torsten
Torsten 2022년 3월 28일
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);

카테고리

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

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by