Not enough input arguments (2024)

26 Ansichten (letzte 30 Tage)

Ältere Kommentare anzeigen

Jack am 11 Jul. 2024 um 10:30

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/2136458-not-enough-input-arguments

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/2136458-not-enough-input-arguments

Kommentiert: Jack am 11 Jul. 2024 um 12:17

Akzeptierte Antwort: Stephen23

  • Steady_State_Parameter_Values.mat
  • FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv
  • FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv

In MATLAB Online öffnen

Hi all, I am a little perplexed by this warning from matlab: "Not enough input arguments" for my following code. I've looked for documentation to see the problem, but it none of them proved to be helpful to my problem. This warning occured at the line "P = z.p" line 47

tic

%% Preparation

clc; clear

data = importdata("FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv"); % insert file path within parenthesis

load Steady_State_Parameter_Values.mat

z = load("Steady_State_Parameter_Values.mat");

%% Preamble

% Fundamental constants

h = 4.1356677*10^-15; % units: eV/ Hz

c = 3*10^8; % SI units

kB = 8.617333268*10^-5; % units: eV/ K

% Parameters from steady state fitting

A1 = p(1,1);

A2 = p(1,2);

Eg = p(1,3);

Eb = p(1,4);

R = p(1,5);

g = p(1,6);

% Data

Wavelength = data(:, 1);% units: nm

E = (h*c)./(Wavelength*10^-9);

delay_t = data(1, :);

carrier_T = [1198.8, 816.7, 446.8, 328.7];

col1 = 56;

col2 = 63;

col3 = 74;

col4 = 87;

% Data for fitting

Range_E = E >= 1.5 & E <= 2.0;

Range_W = Wavelength >= (h*c)/(2.0*10^-9) & Wavelength <= (h*c)/(1.5*10^-9);

E_p = E(Range_E); % selected probe energies

data_new2 = data(Range_W, [col1,col2,col3,col4]);

delta_Abs1 = data(Range_W,col1);

delta_Abs2 = data(Range_W,col2);

delta_Abs3 = data(Range_W,col3);

delta_Abs4 = data(Range_W,col4);

% Fitting function: Elliott's Model for Transient Absorption

function F = EM_TA_wR1(x, e_p, z)

P = z.p;

kB = 8.617333268*10^-5; % units: eV/ K

A1 = P(1,1);

A2 = P(1,2);

Eg = P(1,3);

Eb = P(1,4);

R = P(1,5);

g = P(1,6);

carrier_T = [1198.8, 816.7, 446.8, 328.7];

E_p = e_p(i);

F(i) = x(5)*A1.*((2.*pi.*sqrt(x(2)))./E_p).*1/g.*(integral(@(E)sech(((E_p - E)./g)).*(1 + 10.*R.*(E - x(1)) + ...

126.*(R).^2.*(E - x(1)).^2)./(1 - exp(-2.*pi.*sqrt(x(2)./(E - x(1))))), x(1), Inf, 'ArrayValued', 1)).*(1 - 1./(1 + exp((E_p - x(4))./(kB.*carrier_T(1,1))))).^2 - ...

A1.*(2.*pi.*sqrt(Eb)/E_p).*(1/g).*...

(integral(@(e)sech(((E_p - e)./g)).*(1 + 10.*R.*(e - Eg) + ...

126.*(R).^2.*(e - Eg).^2)./(1 - exp(-2.*pi.*sqrt(Eb./(e - Eg)))), Eg, Inf, 'ArrayValued', 1)) + ...

x(6).*A2.*(4.*pi.*(x(2)).^3/2).*1/x(3).*(...

(1/1^3).*sech((E_p - x(1) + x(2)./1^2)./x(3)) + ...

(1/2^3).*sech((E_p - x(1) + x(2)./2^2)./x(3)) + ...

(1/3^3).*sech((E_p - x(1) + x(2)./3^2)./x(3)) + ...

(1/4^3).*sech((E_p - x(1) + x(2)./4^2)./x(3)) + ...

(1/5^3).*sech((E_p - x(1) + x(2)./5^2)./x(3)) + ...

(1/6^3).*sech((E_p - x(1) + x(2)./6^2)./x(3)) + ...

(1/7^3).*sech((E_p - x(1) + x(2)./7^2)./x(3))) - ...

A2.*(4.*pi.*Eb.^3/2).*1/g.*(...

(1./1.^3).*sech((E_p - Eg + Eb./1.^2)./g) + ...

(1./2.^3).*sech((E_p - Eg + Eb./2.^2)./g) + ...

(1./3.^3).*sech((E_p - Eg + Eb./3.^2)./g) + ...

(1./4.^3).*sech((E_p - Eg + Eb./4.^2)./g) + ...

(1./5.^3).*sech((E_p - Eg + Eb./5.^2)./g) + ...

(1./6.^3).*sech((E_p - Eg + Eb./6.^2)./g) + ...

(1./7.^3).*sech((E_p - Eg + Eb./7.^2)./g));

end

F = F(:);

end

% Solver

lb = [Eg, Eb, g, 0.3, 0.5, 0.2]; ub = [55, 0.05, 0.05, 20, 2, 1];

x0 = [1.65, 0.03, 0.03, 1.3, 1, 0.3];

optim_lsq = optimoptions('lsqcurvefit', 'Algorithm', 'levenberg-marquardt', 'MaxFunctionEvaluations',10^5, 'MaxIterations', 10^5, 'FunctionTolerance',10^-10, 'StepTolerance', 10^-10);

delta_Abs(:, 1) = data_new2(:, 1);

carrierT = carrier_T(1, 1);

x(1, :) = lsqcurvefit(@(x, e_p) EM_TA_wR1, x0, E_p, delta_Abs(:, 1), lb, ub, optim_lsq);

Not enough input arguments.

Error in solution>EM_TA_wR1 (line 47)
P = z.p;

Error in solution>@(x,e_p)EM_TA_wR1 (line 89)
x(1, :) = lsqcurvefit(@(x, e_p) EM_TA_wR1, x0, E_p, delta_Abs(:, 1), lb, ub, optim_lsq);

Error in lsqcurvefit (line 272)
initVals.F = feval(funfcn_x_xdata{3},xCurrent,XDATA,varargin{:});

Caused by:
Failure in initial objective function evaluation. LSQCURVEFIT cannot continue.

plot(E_p, delta_Abs(:, 1), 'o')

hold on

plot(E_p, EM_TA_wR1(x(1, :), E_p, Z), 'LineWidth', 4.0)

hold off

for n = 2:4

delta_Abs(:, n) = data_new2(:,n);

carrierT = carrier_T(1, n);

[x(n, :), residualnorm, residual, exitflag, output, lambda, jacobian] = lsqcurvefit(@(x, E_p) EM_TA_wR(x, E_p, Z), x(n-1, :), E_p, delta_Abs(:, n), lb, ub, optim_lsq);

plot(E_p, delta_Abs(:, n), 'o')

hold on

plot(E_p, EM_TA_wRn(x(n, :), E_p, Z), 'LineWidth', 4.0)

xlabel('Probe Photon Energy (eV)')

ylabel('\Delta A (O.D.)')

legend('0.5 ps', '1.0 ps', '2.0 ps', '4.0 ps', 'Location', 'southeast')

end

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Akzeptierte Antwort

Stephen23 am 11 Jul. 2024 um 11:31

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2136458-not-enough-input-arguments#answer_1484338

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2136458-not-enough-input-arguments#answer_1484338

In MATLAB Online öffnen

"I am a little perplexed by this warning from matlab: "Not enough input arguments" for my following code"

Lets take a look at how you call the function here:

x(1, :) = lsqcurvefit(@(x, e_p) EM_TA_wR1, x0, E_p, delta_Abs(:, 1), lb, ub, optim_lsq);

% ^ zero inputs here

Although you wrote the function EM_TA_wR1 to require three inputs, when you defined that anonymous function you call it with zero inputs. That clearly will not work, you need to call it with all of its required inputs, probably something like this:

@(x, e_p) EM_TA_wR1(x,e_p,z)

2 Kommentare

Keine anzeigenKeine ausblenden

Stephen23 am 11 Jul. 2024 um 11:50

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/2136458-not-enough-input-arguments#comment_3208778

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/2136458-not-enough-input-arguments#comment_3208778

Bearbeitet: Stephen23 am 11 Jul. 2024 um 11:54

In MATLAB Online öffnen

  • FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv
  • Steady_State_Parameter_Values.mat

Lets try it with your uploaded data.

Note that I also:

  • replaced the very unfortunate IMPORTDATA with the much more reliable, recommended READMATRIX
  • removed duplicate LOAD calls
  • marked unused variables

Now the anonymous function is correctly defined it does not throw an error when it is called. However you have problems due to the fact that your initial conditions lead to lots of NaNs in the objective function output. You will have to debug those.

data = readmatrix("FCPIB-293K-2.5mW-400nm-Jan072021 -ibg -bg -chirp.csv");

z = load("Steady_State_Parameter_Values.mat");

%% Preamble

% Fundamental constants

h = 4.1356677*10^-15; % units: eV/ Hz

c = 3*10^8; % SI units

kB = 8.617333268*10^-5; % units: eV/ K !!!! this is unused !!!!

% Parameters from steady state fitting

A1 = z.p(1,1); % !!!! this is unused !!!!

A2 = z.p(1,2); % !!!! this is unused !!!!

Eg = z.p(1,3);

Eb = z.p(1,4);

R = z.p(1,5); % !!!! this is unused !!!!

g = z.p(1,6); % !!!! this is unused !!!!

% Data

Wavelength = data(:, 1);% units: nm

E = (h*c)./(Wavelength*10^-9);

delay_t = data(1, :); % !!!! this is unused !!!!

carrier_T = [1198.8, 816.7, 446.8, 328.7];

col1 = 56;

col2 = 63;

col3 = 74;

col4 = 87;

% Data for fitting

Range_E = E >= 1.5 & E <= 2.0;

Range_W = Wavelength >= (h*c)/(2.0*10^-9) & Wavelength <= (h*c)/(1.5*10^-9);

E_p = E(Range_E); % selected probe energies

data_new2 = data(Range_W, [col1,col2,col3,col4]);

delta_Abs1 = data(Range_W,col1); % !!!! this is unused !!!!

delta_Abs2 = data(Range_W,col2); % !!!! this is unused !!!!

delta_Abs3 = data(Range_W,col3); % !!!! this is unused !!!!

delta_Abs4 = data(Range_W,col4); % !!!! this is unused !!!!

% Solver

lb = [Eg, Eb, g, 0.3, 0.5, 0.2];

ub = [55, 0.05, 0.05, 20, 2, 1];

x0 = [1.65, 0.03, 0.03, 1.3, 1, 0.3];

optim_lsq = optimoptions('lsqcurvefit', 'Algorithm', 'levenberg-marquardt', 'MaxFunctionEvaluations',10^5, 'MaxIterations', 10^5, 'FunctionTolerance',10^-10, 'StepTolerance', 10^-10);

delta_Abs(:, 1) = data_new2(:, 1);

carrierT = carrier_T(1, 1);

fnh = @(x, e_p) EM_TA_wR1(x, e_p, z);

% calling the function now works without error...

fnh(x0, E_p) % but do you expect MATLAB to curve-fit NaNs ????

ans = 345x1

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

<mw-icon class=""></mw-icon>

<mw-icon class=""></mw-icon>

% You need to debug why your calculation produces NaNs:

out = lsqcurvefit(fnh, x0, E_p, delta_Abs(:, 1), lb, ub, optim_lsq);

Error using lsqncommon (line 35)
Objective function is returning Inf or NaN values at initial point. lsqcurvefit cannot continue.

Error in lsqcurvefit (line 322)
lsqncommon(funfcn,xCurrent,lb,ub,options,defaultopt,optimgetFlag,caller,...

% Fitting function: Elliott's Model for Transient Absorption

function F = EM_TA_wR1(x, e_p, z)

P = z.p;

kB = 8.617333268*10^-5; % units: eV/ K

A1 = P(1,1);

A2 = P(1,2);

Eg = P(1,3);

Eb = P(1,4);

R = P(1,5);

g = P(1,6);

carrier_T = [1198.8, 816.7, 446.8, 328.7];

F = nan(size(e_p));

for i = numel(e_p)

E_p = e_p(i);

F(i) = x(5)*A1.*((2.*pi.*sqrt(x(2)))./E_p).*1/g.*(integral(@(E)sech(((E_p - E)./g)).*(1 + 10.*R.*(E - x(1)) + ...

126.*(R).^2.*(E - x(1)).^2)./(1 - exp(-2.*pi.*sqrt(x(2)./(E - x(1))))), x(1), Inf, 'ArrayValued', 1)).*(1 - 1./(1 + exp((E_p - x(4))./(kB.*carrier_T(1,1))))).^2 - ...

A1.*(2.*pi.*sqrt(Eb)/E_p).*(1/g).*...

(integral(@(e)sech(((E_p - e)./g)).*(1 + 10.*R.*(e - Eg) + ...

126.*(R).^2.*(e - Eg).^2)./(1 - exp(-2.*pi.*sqrt(Eb./(e - Eg)))), Eg, Inf, 'ArrayValued', 1)) + ...

x(6).*A2.*(4.*pi.*(x(2)).^3/2).*1/x(3).*(...

(1/1^3).*sech((E_p - x(1) + x(2)./1^2)./x(3)) + ...

(1/2^3).*sech((E_p - x(1) + x(2)./2^2)./x(3)) + ...

(1/3^3).*sech((E_p - x(1) + x(2)./3^2)./x(3)) + ...

(1/4^3).*sech((E_p - x(1) + x(2)./4^2)./x(3)) + ...

(1/5^3).*sech((E_p - x(1) + x(2)./5^2)./x(3)) + ...

(1/6^3).*sech((E_p - x(1) + x(2)./6^2)./x(3)) + ...

(1/7^3).*sech((E_p - x(1) + x(2)./7^2)./x(3))) - ...

A2.*(4.*pi.*Eb.^3/2).*1/g.*(...

(1./1.^3).*sech((E_p - Eg + Eb./1.^2)./g) + ...

(1./2.^3).*sech((E_p - Eg + Eb./2.^2)./g) + ...

(1./3.^3).*sech((E_p - Eg + Eb./3.^2)./g) + ...

(1./4.^3).*sech((E_p - Eg + Eb./4.^2)./g) + ...

(1./5.^3).*sech((E_p - Eg + Eb./5.^2)./g) + ...

(1./6.^3).*sech((E_p - Eg + Eb./6.^2)./g) + ...

(1./7.^3).*sech((E_p - Eg + Eb./7.^2)./g));

end

F = F(:);

end

Jack am 11 Jul. 2024 um 12:17

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/2136458-not-enough-input-arguments#comment_3208798

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/2136458-not-enough-input-arguments#comment_3208798

Hi Stephen, I've made the amendments that you've suggested and now my code could run. Thanks so much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Melden Sie sich an, um diese Frage zu beantworten.

Siehe auch

Tags

  • curve fitting

Produkte

  • MATLAB

Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Es ist ein Fehler aufgetreten

Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.


Translated by Not enough input arguments (5)

Not enough input arguments (6)

Website auswählen

Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .

Sie können auch eine Website aus der folgenden Liste auswählen:

Amerika

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europa

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asien-Pazifik

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Kontakt zu Ihrer lokalen Niederlassung

Not enough input arguments (2024)

References

Top Articles
Visa Tour Show Wish Fanny Sanin Hits Song Maps Top Food Chain YMCA Gym Zumba Clarence Public Library Clean Shred Buff State Last Day Passover Songs From Rock & Roll 1990 Ma’s Birthday Gifts Cold Clothing Back Camp Dogs Fun The Alpha Baa Baa Twinkle
Trinity Portal Minot Nd
What Is Single Sign-on (SSO)? Meaning and How It Works? | Fortinet
Barstool Sports Gif
Use Copilot in Microsoft Teams meetings
WALB Locker Room Report Week 5 2024
Goodbye Horses: The Many Lives of Q Lazzarus
Summit County Juvenile Court
Wmu Course Offerings
Gabrielle Abbate Obituary
Crime Scene Photos West Memphis Three
Robert Malone é o inventor da vacina mRNA e está certo sobre vacinação de crianças #boato
Inside the life of 17-year-old Charli D'Amelio, the most popular TikTok star in the world who now has her own TV show and clothing line
CANNABIS ONLINE DISPENSARY Promo Code — $100 Off 2024
Energy Healing Conference Utah
Traveling Merchants Tack Diablo 4
Bekijk ons gevarieerde aanbod occasions in Oss.
Melendez Imports Menu
Winco Employee Handbook 2022
Minnick Funeral Home West Point Nebraska
What Time Does Walmart Auto Center Open
Yugen Manga Jinx Cap 19
Troy Gamefarm Prices
What Equals 16
Regina Perrow
Kabob-House-Spokane Photos
EVO Entertainment | Cinema. Bowling. Games.
13301 South Orange Blossom Trail
Cfv Mychart
Hannah Jewell
Street Fighter 6 Nexus
Gr86 Forums
UPS Drop Off Location Finder
In Branch Chase Atm Near Me
Texters Wish You Were Here
Devin Mansen Obituary
Bimar Produkte Test & Vergleich 09/2024 » GUT bis SEHR GUT
Giantess Feet Deviantart
The best specialist spirits store | Spirituosengalerie Stuttgart
Bustednewspaper.com Rockbridge County Va
National Weather Service Richmond Va
Blue Beetle Showtimes Near Regal Evergreen Parkway & Rpx
Chubbs Canton Il
Argus Leader Obits Today
Google Flights Missoula
Mkvcinemas Movies Free Download
Parks And Rec Fantasy Football Names
Thrift Stores In Burlingame Ca
Gameplay Clarkston
Mazda 3 Depreciation
Obituary Roger Schaefer Update 2020
Sunset On November 5 2023
Latest Posts
Article information

Author: Van Hayes

Last Updated:

Views: 6237

Rating: 4.6 / 5 (66 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.