Lỗi sign qq you already signed in this account

problem but nobody seems to be able to explain or solve it in plain English. Could somebody please explain what this error is and how to fix it?

I have a simple function:

function [r]=Mec134function(w,theta_deg)

t2=10000;

theta_rad=(theta_deg./180).*pi;

t1=55090./(10*sin(theta_rad));

rx=(t1.*cos(theta_rad))-t2;

ry=w-(t1.*sin(theta_rad));

r=((rx).^2+(ry).^2).^0.5;

end

It seems to give this error for line 3 but I'm not sure why.

Thanks.

Accepted Answer

Lỗi sign qq you already signed in this account

Your function defines 2 input arguments (w and theta_deg). When you run Mec134function, you must specify exactly two inputs, otherwise you will get the error "Not enough input arguments".

For example, if you run the Mec134function in the command window without specifying any arguments:

You get this error:

Not enough input arguments.

Error in Mec134function (line 3)

theta_rad=(theta_deg./180).*pi;

If you run the Mec134function and specify two input arguments, "w" and "theta_deg" (assuming "w" and "theta_deg" are defined), you do not get the error message:

\>> Mec134function(w,theta_deg)

If you have the file "Mec134function.m" open in the Editor and you try to run the function by pressing the "Run" button or F5, MATLAB runs the Mec134function without any input arguments, and you get the error "Not enough input arguments". The "Run" button dropdown menu then opens prompting you to enter values for the missing input arguments.

Add the desired values and press enter. The values you enter are set as the default inputs when you click the "Run" button or F5 in the future.

To change the values, press the down arrow below the "Run" button and enter new values.

More Answers (19)

Lỗi sign qq you already signed in this account

sorry the function is

function [r]=Mec134function(w,theta_deg)

t2=10000;

theta_rad=(theta_deg./180).*pi;

t1=55090./(10*sin(theta_rad));

rx=(t1.*cos(theta_rad))-t2;

ry=w-(t1.*sin(theta_rad));

r=((rx).^2+(ry).^2).^0.5;

end

if that's clearer :-)


Lỗi sign qq you already signed in this account

Thanks :-)

will have a look at the "getting started"

I have a simple function:

function [r]=Mec134function(w,theta_deg)

t2=10000;

theta_rad=(theta_deg./180).*pi;

t1=55090./(10*sin(theta_rad));

rx=(t1.*cos(theta_rad))-t2;

ry=w-(t1.*sin(theta_rad));

r=((rx).^2+(ry).^2).^0.5;

end

that seems to give this error for line 2 but I'm not sure why.


Lỗi sign qq you already signed in this account

I too am very new to Matlab, and tried to run the code above in .m (JP Donlon on Nov. 7th). However, I keep getting an error stating "Not enough input arguments." I'm not sure what this means, because I have attempted to run other code by professors which works on other computers. Is it something with my preference settings?

Also, when I run the Code Analyzer, there are no issues...not sure what is going on.


Lỗi sign qq you already signed in this account

How to rectify this error

Error using DetectFace (line 68)

Not enough input arguments.

the code is given below

I=imread('lena.jpg');

minFace = 20;

maxFace = 4000;

overlappingThreshold = 0.5;

numThreads = 24;

if nargin > 2 && ~isempty(options)

if isfield(options, 'minFace') && ~isempty(options.minFace)

minFace = options.minFace;

end

if isfield(options, 'maxFace') && ~isempty(options.maxFace)

maxFace = options.maxFace;

end

if isfield(options, 'overlappingThreshold') && ~isempty(options.overlappingThreshold)

overlappingThreshold = options.overlappingThreshold;

end

if isfield(options, 'numThreads') && ~isempty(options.numThreads)

numThreads = options.numThreads;

end

end

if ~ismatrix(I)

I = rgb2gray(I);

end

candi_rects = NPDScan(model, I, minFace, maxFace, numThreads);

if isempty(candi_rects)

rects = [];

return;

end


Lỗi sign qq you already signed in this account

clc; clear; close all;

xo=0.4;

A=[];

b=[];

Aeq=[];

beq=[];

Q=100;

R=1;

N = 50;

U0= zeros(100,1);

x=xo; h = 0.1;

xo=[-0.5,0.5];

options = optimoptions(@fmincon,'Algorithm','sqp');

U = fmincon(@cost1,U0,[],[],[],[],[],[],@confuneq,options);

for k =1:N

S1= F(x(k),U(k));

S2=F(x(k)+0.5*h*S1,U(k));

S3=F(x(k)+0.5*h*S2,U(k));

S4=F(x(k)+h*S3,U(k));

x(k+1) = x(k) + (1/6)* (S1+ 2*S2+ 2*S3 + S4)*h;

k = k + 1 ;

end

plot(U);

grid on

figure(); plot(x)

grid on

I new to matlab.Can anyone help me to fix the iisue here.

Its showing not enough input arguments.


Lỗi sign qq you already signed in this account

Hello sir,I am newer to matlab. I am getting error in this code like "preprocessing requries more input arugument to run". can you please to run this program. my project topic is recognition and matching fake logos using filters.

function img=preprocessing(I)

[x y o]=size(I);

if o==3

I=rgb2gray(I);

end

I=im2double(I);

med=medfilt2(I);

figure,imshow(med)

title('MEDIAN FILTERED IMAGE')

[psnr_med,mse_med]=psnr(I,med)

out7= imfilter(I, fspecial('average'));

figure,imshow(out7)

title('MEAN FILTERED IMAGE')

[psnr_avg,mse_avg]=psnr(I,out7)

gau=imfilter(I,fspecial('gaussian'));

figure,imshow(gau)

title('GAUSSIAN FILTER IMAGE')

[psnr_gau,mse_avg]=psnr(I,gau)

psf=fspecial('gaussian',7,10);

image1=imfilter(I,psf,'conv','circular');

var1=(1/256)^2/12;

var2=var(I(:));

wei=deconvwnr(image1,psf,(var1/var2));

figure,imshow(wei);title('WEINER FILTERED IMAGE');

[psnr_wei,mse_wei]=psnr(I,wei)

psnr_all=[psnr_med,psnr_avg,psnr_gau,psnr_wei];

psnr_max=max(psnr_all);

val=find(psnr_all==psnr_max);

if val==1

img=med;

disp('median have high psnr');

elseif val==2

img=out7;

disp('mean have high psnr');

elseif val==3

img=gau;

disp('gaussian have high psnr');

else

img=wei;

disp('weiner have high psnr');

end


Lỗi sign qq you already signed in this account

I am getting error for below function as "Not enough input arguments. "

delayed_signal = mtapped_delay_fcn(input);


Lỗi sign qq you already signed in this account

Hi I'm trying to run Dr. John Stockie's matlab code but I am getting a "Not enough input argument" error. I'm not very well verse with Matlab, so I would appreciate any help...Thank you. I am pasting the code:

function C = ermak( x, y, z, H, Q, U, Wset, Wdep )

Umin = 0.0;

ay = 0.34; by = 0.82; az = 0.275; bz = 0.82;

sigmay = ay*abs(x).^by .* (x > 0);

sigmaz = az*abs(x).^bz .* (x > 0);

Kz = 0.5*az*bz*U*abs(x).^(bz-1) .* (x > 0);

if U < Umin,

C = 0 * z;

else

Wo = Wdep - 0.5*Wset;

C = Q ./ (2*pi*U*sigmay.*sigmaz) .* exp( -0.5*y.^2./sigmay.^2 ) .* ...

exp( -0.5*Wset*(z-H)./Kz - Wset^2*sigmaz.^2/8./Kz.^2 ) .* ...

( exp( -0.5*(z-H).^2./sigmaz.^2 ) + ...

exp( -0.5*(z+H).^2./sigmaz.^2 ) - sqrt(2*pi)*Wo*sigmaz./Kz .* ...

exp( Wo*(z+H)./Kz + 0.5*Wo^2*sigmaz.^2./Kz.^2 ) .* ...

erfc( Wo*sigmaz/sqrt(2)./Kz + (z+H)./sqrt(2)./sigmaz ) );

ii = find(isnan(C) | isinf(C));

C(ii) = 0;

end

and the error message refers to "sigmay" in line 31


Lỗi sign qq you already signed in this account

function test(num1, num2,small,s)

load (small, num1, num2)

s = sum(num1, num2)

end

this the code for this i'm getting these errors

Not enough input arguments.

Error in test (line 3)

load (small, num1, num2)


Lỗi sign qq you already signed in this account

Hello. Am new in Matlab and I want to do my assignment with this function refraction_2layers and Matlab is saying error using refraction_2layers (line 18 and 25) Here is the whole program

function refraction_2layers(v1, v2, z, FIRST_ARRIVALS_ONLY);

if nargin < 4 FIRST_ARRIVALS_ONLY = 0; end

x = [0:5:300];

t1 = x./v1;

t2 = (2*z*sqrt(v2^2-v1^2)/(v1*v2))+x./v2;

xcrit = 2*z*v1/(sqrt(v2^2-v1^2));

if isreal(xcrit)

a = min(find(x>xcrit));

end

crossover = ((2*z*sqrt(v2^2-v1^2))/(v1*v2))/(1/v1-1/v2);

b = max(find(x<= crossover));

if FIRST_ARRIVALS_ONLY

plot(x(1:b),t1(1:b)*1000, '.--')

hold on

if isreal(t2)

plot(x(b:end), t2(b:end)*1000, 'r.--')

end

else

plot(x,t1*1000, '.--')

hold on

if isreal(t2)

plot(x(a:end), t2(a:end)*1000, 'r.--')

end

end

xlabel('GEOPHONE OFFSET (m)')

ylabel('TIME (ms)')

grid on

legend('DIRECT WAVE', 'HEAD WAVE')

title(['z1 = ', num2str(z), ' m; v1 = ', num2str(v1), ' m/s; v2 = ', num2str(v2), ' m/s'])

axis ([0 300 0 300])

hold off


Lỗi sign qq you already signed in this account

I am really struggling to figure out this "not enough input arguments" error in my code. Any help would be greatly appreciated! This is for a batch distillation problem, and the error is referring to the temp function near the bottom. The code and error are below:

P = 912;

L0 = 100;

A = [6.90565 6.95464]; B=[1211.033 1344.8]; C=[220.79 219.482];

xtspan = linspace(0.40,0.80,100);

[xt, L] = ode45(@Moles, xtspan, L0);

L = L(end);

fprintf('The amount of liquid remaining in the still when liquid mole fraction of toluene reaches 0.80 is %f moles', L);

function Kt = EquilibriumRatio(Psatt)

Kt = Psatt/P;

end

function Psatt = VaporPressuret(T,A,B,C)

Psatt = 10^(A(2)-B(2)/(T+C(2)));

end

function Psatb = VaporPressureb(T,A,B,C)

Psatb = 10^(A(1)-B(1)/(T+C(1)));

end

function dLdx = Moles(xt,L)

T0 = 95.585;

options = optimset('Display','off','TolX',1e-6);

T = fzero(@temp, T0, options);

Psatt = VaporPressuret(T);

Kt = EquilibriumRatio(Psatt);

dLdx = L/(xt*(Kt-1));

end

function Tempfun = temp(T,xt,P,A,B,C)

Psatt = VaporPressuret(T,A,B,C);

Psatb = VaporPressureb(T,A,B,C);

Tempfun = Psatt*xt + Psatb*(1-xt) - P;

end

\>> project2

Error using fzero (line 306)

FZERO cannot continue because user-supplied function_handle ==> temp failed with the error below.

Not enough input arguments.

Error in project2>Moles (line 30)

T = fzero(@temp, T0, options);

Error in odearguments (line 90)

f0 = feval(ode,t0,y0,args{:});

Error in ode45 (line 115)

odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);

Error in project2 (line 7)

[xt, L] = ode45(@Moles, xtspan, L0);


Lỗi sign qq you already signed in this account

hi

I am new to matlab. i am getting error message "extract_features" requires more input arguments to run.

anderror in command window :

\>> Extract_Features

Not enough input arguments.

Error in Extract_Features (line 2)

img1 = imread(filename);

code is written below:

function Extract_Features(filename,flag)

if ndims(img1) == 3; img1 = rgb2gray(img1); end

disp(['Extracting features from ' filename ' ...']);

plot(fir(fir1,1),fir(fir1,2),'r+');

plot(fir(fir3,1),fir(fir3,2),'bo');

filename2=filename; filename2(end-1)='x'; filename2(end)='t';

save(filename2,'fir','-ascii');


Lỗi sign qq you already signed in this account

Can someone help me please

envelope = sqrt(movmean(rec_EMG.^2), 'window');

I was trying to do get the RMS but it says:

Error using movmean Not enough input arguments.

I didn't understand that, as I already use two arguments there.

Thanks fo ryour help


Lỗi sign qq you already signed in this account

Can any one help me this please

function u = Anti_Tv(g,my,gamma)

gHS = uint8(imadjust (g));

gGC = uint8(255.*((double(g)./255).^(gamma)));

g = double(g(:));

n = length(g);

b = zeros(2*n,1);

d = b;

u = g;

eer = 1;k = 1;

tol = 1e-3;

Lambda = 0.05

[B, Bt, BtB] = DiffOper(sqrt(n));

Not enough input arguments


Lỗi sign qq you already signed in this account

Dear Matlab experts, If anyone one of you would like to assist me running the below code i would be really greatfule to you.

The error i am getting.

qardlecm

Not enough input arguments.

Error in qardlecm (line 24)

nn = size(data,1);

The code i want to run

....................................................................................................................................................................................................

function[bigphia,bigpia,thett,distthett] = qardlecm(data,ppp,qqq,tau)

pd = makedist('normal','mu',0,'sigma',1);

hb(jj,1) = (4.5*normpdf(icdf(pd,tau(jj,1)))^4/(nn*(2*icdf(pd,tau(jj,1))^2+1)^2))^0.2;

hs(jj,1) = za^(2/3)*(1.5*normpdf(icdf(pd,tau(jj,1)))2/(nn*(2*icdf(pd,tau(jj,1))^2+1)))(1/3);

xx = data(:,2:size(data,2));

ee = xx(2:nn,:) - xx(1:(nn-1),:);

eei = zeros(nn-qqq,qqq*k0);

eei(:, ii+1+(jj-1)*qqq) = ee((qqq+1-ii):(nn-ii),jj);

yyi(:,ii) = yy((1+ppp-ii):(nn-ii),1);

X = [eei((size(eei,1)+1-size(yyi,1)):size(eei,1),:), xxi((size(xxi,1)+1-size(yyi,1)):size(xxi,1),:), yyi];

X = [eei, xxi, yyi((size(yyi,1)+1-size(xxi,1)):size(yyi,1),:)];

ONEX = [ones(size(X,1),1),X];

Y = yy((nn-size(X,1)+1):nn,1);

bt = zeros(size(ONEX,2),ss);

[bt1] = qregressMatlab(Y,ONEX,tau(jj,1));

fh(jj,1) = mean(normpdf(-uu(:,jj)/hb(jj,1)))/hb(jj,1);

barw = zeros(nn-1,qqq*k0);

barw(jj:(nn-1),(k0*(jj-1)+1):k0*jj) = ee(2:(nn-jj+1),:);

tw = [ones(nn-1,1), barw];

mm = (xx((qqq+1):nn,:)'*xx((qqq+1):nn,:) - xx((qqq+1):nn,:)'*tw(qqq:(nn-1),:)*inv(tw(qqq:(nn-1),:)'*tw(qqq:(nn-1),:))*tw(qqq:(nn-1),:)'*xx((qqq+1):nn,:))/(nn-qqq)^2;

bb(jj,1) = 1/((1-sum(bt(2+(qqq+1)*k0:1+(qqq+1)*k0+ppp,jj),1)')*fh(jj,1));

qq(jj,ii) = (min(psu,[],1)' - tau(jj,1)*tau(ii,1))*bb(jj,1)*bb(ii,1);

midbt(:,jj) = bt(2+qqq*k0:1+(qqq+1)*k0,jj)/(1-sum(bt(2+(qqq+1)*k0:1+(qqq+1)*k0+ppp,jj),1)');

bigbt = reshape(midbt,[],1);

bigbtmm = kron(qq,inv(mm));

wwj = zeros(nn-ppp,qqq*k0);

yyj(:,jj) = yy((ppp+1-jj):(nn-jj),1);

wwj(:,jj+(ii-1)*qqq) = ee((ppp-jj+2):(nn-jj+1),ii);

kk = zeros(nn-ppp,ss*ppp);

ONEX = [ones(nn-ppp,1),xxj,wwj];

[bbt] = qregressMatlab(Y,ONEX,tau(ii,1));

kk(:,jj+(ii-1)*ppp) = kkk;

llla = (kka'*kka - kka'*tilw*inv(tilw'*tilw)*tilw'*kka)/(nn-ppp);

wwj = zeros(nn-qqq,qqq*k0);

yyj(:,jj) = yy((qqq+1-jj):(nn-jj),1);

wwj(:,jj+(ii-1)*qqq) = ee((qqq-jj+2):(nn-jj+1),ii);

kk = zeros(nn-qqq,ss*ppp);

ONEX = [ones(nn-qqq,1), xxj, wwj];

[bbt] = qregressMatlab(Y,ONEX,tau(jj,1));

kk(:,jj+(ii-1)*ppp) = kkk;

llla = (kka'*kka - kka'*tilw*inv(tilw'*tilw)*tilw'*kka)/(nn-qqq);

cc(jj,ii) = (min(psu,[],1)' - tau(jj,1)*tau(ii,1))/(fh(ii,1)*fh(jj,1));

bigpia = zeros(ss*(ppp-1),ss*(ppp-1));

psu = inv(llla((jj-1)*(ppp-1)+1:jj*(ppp-1),(jj-1)*(ppp-1)+1:jj*(ppp-1)))*llla((jj-1)*(ppp-1)+1:jj*(ppp-1),(ii-1)*(ppp-1)+1:ii*(ppp-1))*inv(llla((ii-1)*(ppp-1)+1:ii*(ppp-1),(ii-1)*(ppp-1)+1:ii*(ppp-1)));

bigpia((jj-1)*(ppp-1)+1:jj*(ppp-1),(ii-1)*(ppp-1)+1:ii*(ppp-1)) = cc(jj,ii)*psu;

midphi(:,jj) = bt(2+(qqq+1)*k0:1+(qqq+1)*k0+ppp,jj);

bigphi = reshape(midphi,[],1);

bigphia = [bigphia1; bigphia2; bigphia3];

dg = [nn^(1/2),0,0; 0,nn^(1/2),0; 0,0,nn];

r2 = sum(tilwb,1)*(nn-2)^(-1);

r3 = sum(xx(3:nn,1),1)*(nn-2)^(-3/2);

rh9 = xx(3:nn,1)'*xx(3:nn,1);

QQQ = [r1, r2, r3 ; r4, r5, r6; r7, r8, r9];

psiu(rr,jj) = tau(jj,1)-1;

sigmma = psiu'*psiu*(1/(nn-2));

sigma1 = mean(psiu1.^(2));

sigma2 = mean(psiu2.^(2));

sigma3 = mean(psiu3.^(2));

distmt1 = nn*fh(1,1)^(-2)*sigmma(1,1)*inv(dg)*inv(QQQ)*inv(dg);

distmt2 = nn*fh(1,1)(-1)*fh(2,1)(-1)*sigmma(1,2)*inv(dg)*inv(QQQ)*inv(dg);

distmt3 = nn*fh(1,1)(-1)*fh(3,1)(-1)*sigmma(1,3)*inv(dg)*inv(QQQ)*inv(dg);

distmt4 = nn*fh(2,1)(-1)*fh(1,1)(-1)*sigmma(2,1)*inv(dg)*inv(QQQ)*inv(dg);

distmt5 = nn*fh(2,1)^(-2)*sigmma(2,2)*inv(dg)*inv(QQQ)*inv(dg);

distmt6 = nn*fh(2,1)(-1)*fh(3,1)(-1)*sigmma(2,3)*inv(dg)*inv(QQQ)*inv(dg);

distmt7 = nn*fh(3,1)(-1)*fh(1,1)(-1)*sigmma(3,1)*inv(dg)*inv(QQQ)*inv(dg);

distmt8 = nn*fh(3,1)(-1)*fh(2,1)(-1)*sigmma(3,2)*inv(dg)*inv(QQQ)*inv(dg);

distmt9 = nn*fh(3,1)^(-2)*sigmma(3,3)*inv(dg)*inv(QQQ)*inv(dg);

distcon1 = A11 + A12 + A13;

distcon2 = A21 + A22 + A23;

distcon3 = A31 + A32 + A33;

distcon4 = A41 + A42 + A43;

distcon5 = A51 + A52 + A53;

distcon6 = A61 + A62 + A63;

distcon7 = A71 + A72 + A73;

distcon8 = A81 + A82 + A83;

distcon9 = A91 + A92 + A93;

distthett = [distcon1, distcon2, distcon3 ; distcon4, distcon5, distcon6 ; distcon7, distcon8, distcon9];

thett1 = bt(2,1) + bt(3,1);

thett2 = bt(2,2) + bt(3,2);

thett3 = bt(2,3) + bt(3,3);

thett = [thett1 ; thett2 ; thett3];


Lỗi sign qq you already signed in this account

Edited: DGM on 22 Feb 2023

I get Unrecognized function or variable 'theta'.

how to fix it

function hpol =polar_dB(theta,rho,rmin,rmax,rticks,line_style)

error('Requires 5 or 6 input arguments.')

theta = th(:,ones(1,nr));

theta = th(:,ones(1,nr));

if isstr(theta) || isstr(rho)

error('Input arguments must be numeric.');

if any(size(theta) ~= size(rho))

error('THETA and RHO must be the same size.');

next = lower(get(cax,'NextPlot'));

fAngle = get(cax, 'DefaultTextFontAngle');

fName = get(cax, 'DefaultTextFontName');

fSize = get(cax, 'DefaultTextFontSize');

fWeight = get(cax, 'DefaultTextFontWeight');

set(cax, 'DefaultTextFontAngle', get(cax, 'FontAngle'), ...

'DefaultTextFontName', font_name, ...

'DefaultTextFontSize', font_size, ...

'DefaultTextFontWeight', get(cax, 'FontWeight') )

hhh=plot([0 max(theta(:))],[min(rho(:)) max(rho(:))]);

v = [get(cax,'xlim') get(cax,'ylim')];

ticks = length(get(cax,'ytick'));

elseif rem(rticks,3) == 0

inds = 1:(length(th)-1)/4:length(th);

xunits(inds(2:2:4)) = zeros(2,1);

yunits(inds(1:2:5)) = zeros(3,1);

rinc = (rmax-rmin)/rticks;

for i=(rmin+rinc):rinc:rmax

plot(xunit*is,yunit*is,'-','color',tc,'linewidth',0.5);

text(0,is+rinc/20,[' ' num2str(i)],'verticalalignment','bottom' );

cst = cos(th); snt = sin(th);

plot((rmax-rmin)*cs,(rmax-rmin)*sn,'-','color',tc,'linewidth',0.5);

cst2 = cos(th2); snt2 = sin(th2);

cs2 = [(rmax-rmin-george)*cst2; (rmax-rmin)*cst2];

sn2 = [(rmax-rmin-george)*snt2; (rmax-rmin)*snt2];

plot(cs2,sn2,'-','color',tc,'linewidth',0.15);

plot(-cs2,-sn2,'-','color',tc,'linewidth',0.15);

text(rt*cst(i),rt*snt(i),int2str(abs(i*30-90)),'horizontalalignment','center' );

loc = int2str(180-(i*30+90-180));

text(-rt*cst(i),-rt*snt(i),loc,'horizontalalignment','center' );

axis((rmax-rmin)*[-1 1 -1.1 1.1]);

set(cax, 'DefaultTextFontAngle', fAngle , ...

'DefaultTextFontName', font_name, ...

'DefaultTextFontSize', fSize, ...

'DefaultTextFontWeight', fWeight );

if theta(i)*180/pi >=0 && theta(i)*180/pi <=90

xx(i) = (rho(i)-rmin)*cos(pi/2-theta(i));

yy(i) = (rho(i)-rmin)*sin(pi/2-theta(i));

elseif theta(i)*180/pi >=90

xx(i) = (rho(i)-rmin)*cos(-theta(i)+pi/2);

yy(i) = (rho(i)-rmin)*sin(-theta(i)+pi/2);

elseif theta(i)*180/pi < 0

xx(i) = (rho(i)-rmin)*cos(abs(theta(i))+pi/2);

yy(i) = (rho(i)-rmin)*sin(abs(theta(i))+pi/2);

if strcmp(line_style,'auto')

q = plot(xx,yy,line_style);

axis('equal');axis('off');

if ~hold_state, set(cax,'NextPlot',next); end


Lỗi sign qq you already signed in this account

Dear Matlab expert, please help me. My Matlab is 2016a, I try to run a code but there is an error "Not enough input arguments."

Error in astar (line 3)

ssNode = startNode;

function [ClosedList,cost,heuristic,func,iteration] = astar(source,target,weights,heuristics,startNode,goalNode)

[s,t,n,sNode,gNode] = refactor(source,target,weights,sNode,ggNode);

ClosedList = struct('Path' ,sNode,'Cost',0,'Heuristic',heuristics(sNode),'F',heuristics(sNode));

OpenList = [OpenList ClosedList];

while(isGoalReached(OpenList,gNode)==0 && ~isempty(OpenList)) [minI,minP] = minPath(OpenList);

newPaths = getNewPaths(s,t,weights,heuristics,minP); OpenList = [OpenList newPaths];

[~,minP] = minPath(OpenList);

ClosedList = n(minP.Path);

heuristic = minP.Heuristic;

function [minIndex,ClosedList] = minPath(paths)

ClosedList = paths(minIndex);

if(paths(i).F < ClosedList.F)

ClosedList = paths(minIndex);

function isGoal = isGoalReached(paths,goalNode)

[~,minP] = minPath(paths);

if(minP.Path(length(minP.Path)) == goalNode)

function weight = getWeight(s,t,weights,nodeA,nodeB)

if(s(i)==nodeA && t(i)==nodeB)

function paths = getNewPaths(s,t,w,h,path)

uniqueNodes = getNodes(s,t);

currentNode = path.Path(length(path.Path)); childs = getChilds(s,t,currentNode);

if(isempty(find(path.Path==childs(i), 1)))

c = path.Cost + getWeight(s,t,w,currentNode,childs(i));

heur = h(uniqueNodes==childs(i));

p = struct('Path',[path.Path childs(i)],'Cost',c,'Heuristic',heur,'F',f);

function childs = getChilds(source,target,node)

childs = sort(target(source==node));

function nodes = getNodes(s,t)

nodes = unique(horzcat(s,t));

function [s,t,n,sn,gn] = refactor(source,target,~,startNode,goalNode)

uNodes = unique(horzcat(source,target)); n = uNodes;

uNodes = unique(horzcat(source,target));

[~,sIndex] = ismember(source(i),uNodes);

[~,tIndex] = ismember(target(i),uNodes);


Lỗi sign qq you already signed in this account

Sol this programm

function I = Int(rho, z, t, fdphi)

global D lam alpha0 L0 Ep tau gamma M2 f w;

gamma = n2 * lam ./ (2 * pi);

w0 = (1e-3 * M2 * lam * f) ./ (pi * w);

wz = w0 * sqrt(1 + (z ./ z0)^2);

Rz = z * (1 + (z0 / z)^2);

r = linspace(0, wz, 100);

Leff = L * (1 - exp(-alpha0 * L0)) / alpha0;

dphi = k * Leff * gamma * Ep * 1e21 * exp(-2 * r.^2 ./ wz.^2) .* exp(-4 * log(2 * t^2 / tau^2)) ./ (1 + (z / z0)^2);

Iint = Iint - 1i * k * r.^2 / (2 * Rz);

Isec = k * rho(m) * r / D;

Isec = besselj(0, Isec) .* Iint;

Isec = trapz(r, Isec) * dr;

Iprim = (4 * pi^2 * Ep) / (lam * D)^2 * (w0 / wz)^2 * exp(-alpha0 * L0);

Iprim = Iprim * exp(-4 * log(2) * t^2 / tau^2);

xlabel('Radial Coordinate (mm)');

title('Far Field Intensity');

rho = linspace(-15/2, 15/2, 100);

xlabel('Radial Coordinate (mm)');

title('Far Field Intensity');


Lỗi sign qq you already signed in this account

Np=100;a=le-10;X=a*[1:1:Np];t0=(hbar^2)/(2*m*(a^2))/q;L=a*(Np+1);

T=(2*t0*diag(ones(1,Np)))-(t0*diag(ones(1,Np-1),1))-(t0*diag(ones(1,Np-1),-1));

[V,D]=eig(T);D=diag(D);[Enum,ind]=sort(D);

El=D(ind(1));psil=abs(V(:,ind(1)));P1=psil.*conj(psil);

E2=D(ind(50));psi2=abs(V(:,ind(50)));P2=psi2.*conj(psi2);

Ean=(((hbar*pi)^2)/(2*m*(L^2))/q)*[1:Np].*[1:Np];

xlabel(' Eigenvalue Number,alpha-->');

See Also

Categories

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.