Borrar filtros
Borrar filtros

1)Error using integral2ParseArgs (line 13)Expected a string for the parameter name,instead the input was 'double' 2)Error in integral2 (line 104) opstruct = integral2P​arseArgs(i​sImproper,​varargin{:​}); I am getting these two errors.what should bedone

6 visualizaciones (últimos 30 días)
pdf=N*exp(-N.*x);
xmin=0;
xmax=b;
ymin=0;
ymax=inf;
f=@(x,y)log(1+((Zt.*y).\(Zs.*x)+1))+log(1+((Zt.*y).\(Zi+1))).*pdf;
A= integral2(f,y,ymin,ymax,x,xmin,xmax);
  2 comentarios
madhan ravi
madhan ravi el 7 de Sept. de 2018
Provide all the details which was not defined in the code above and update it so that we could test it ?
sathia charu
sathia charu el 8 de Sept. de 2018
Editada: Walter Roberson el 8 de Sept. de 2018
close all
clear all
clc
Pt=input('primary users transmit power:');
Ps=input('secondary users transmit power:');
Pr=input('primary user receive power:');
%{
Hs=input('secondary transmitter channel gain:');
Ht=input('primary transmitter channel gain:');
He=input('evasdropper receiver channel gain:');
Hr=input('secondary receiver channel gain:');
%}
I= input('interference temperature:');
x=0;
y=0;
z=0;
t=0;
Hs=0;
Hr=0;
Ht=0;
He=0;
sigma = 5;
for N=0:2:10
Zt= Pr.\(sigma.^2);
Zs= Ps.\(sigma.^2);
Zi= I.\(sigma.^2);
x=(mod(Hs,Hr)).^2;
y=(mod(Ht,Hr)).^2;
z=(mod(Hs,He)).^2;
t=(mod(Ht,He)).^2;
b= Zi.\Zs;
pdf=N*exp(-N.*x);
xmin=0;
xmax=b;
ymin=0;
ymax=inf;
f=@(x,y)log(1+((Zt.*y).\(Zs.*x)+1))+log(1+((Zt.*y).\(Zi+1))).*pdf;
A= integral2(f,y,ymin,ymax,x,xmin,xmax);
fun1=@(x,y) log(1+((Zt.*t).\((Zs.*z)+1)))+log(1+((Zt.*t).\(Zi(z.\x)))).*pdf;
B=integral2(fun1,y,ymin,ymax,x,xmin,xmax);
Rs=(A-B) ;
end

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 7 de Sept. de 2018
q = integral2(fun,xmin,xmax,ymin,ymax)
Notice that variable name is not passed as part of the bounds and that you cannot pass y boundaries before x boundaries.
Symbolic integration requires that the name of the variable be passed before the bound but numeric integration is fixed order
  1 comentario
Walter Roberson
Walter Roberson el 8 de Sept. de 2018
I stand by my response. You should not be passing in the variable name for integral2().
You can use
B = integral2(@(y,x) fun1(x,y), ymin, ymax, xmin, xmax)
if you need the y to be the "inner" variable for integration.
Order that the parameters vary should not matter if the bounds are fixed: it should only matter if the bounds are expressed in terms of each other. For example,
integrate fun1(x,y) over y = 0 to 5, x = 0 to sin(y)^2
then in that case the x passed into fun1 would have to be the second set of bounds because integral2 can accept functions handles for the second set of bounds but not for the first:
B = integral2(@(y,x) fun1(x,y), 0, 5, 0, @(y) sin(y).^2)

Iniciar sesión para comentar.

Categorías

Más información sobre Dynamic System Models en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by