From: garima on
Hi, I am having trouble using QUADGK, i have listed below the error i am getting. Also I need help for defining function with parameter, right now i have given the entire expression for the function(with one parameter) inside the quadgk command, but how can I do it in separate m file? -thanks

>> f1(s)=quadgk((@(x)(real((x+sqrt(-1)*0.0001)./(sqrt((x+sqrt(-1)*0.0001).^2 - (0.0025).^2)))).*2320*exp((x+v).*2320)./((exp((x+v).*2320 )+ 1).^2)),-0.1,0.1,[],[],v);
??? SWITCH expression must be a scalar or string constant.

Error in ==> quadgk>parseOptions at 531
switch propname

Error in ==> quadgk at 149
parseOptions(varargin{:});

>> f1(s)=quadgk((@(x)(real((x+sqrt(-1)*0.0001)/(sqrt((x+sqrt(-1)*0.0001)^2 - (0.0025)^2))))*2320*exp((x+v)*2320)/((exp((x+v)*2320 )+ 1)^2)),-0.1,0.1,[],[],v);
??? SWITCH expression must be a scalar or string constant.

Error in ==> quadgk>parseOptions at 531
switch propname

Error in ==> quadgk at 149
parseOptions(varargin{:});
From: Michael Hosea on
Please see my reply to your other thread.
--
Mike

"garima" <garima.saraswat(a)gmail.com> wrote in message
news:1071005563.78867.1264833213704.JavaMail.root(a)gallium.mathforum.org...
> Hi, I am having trouble using QUADGK, i have listed below the error i am
> getting. Also I need help for defining function with parameter, right now
> i have given the entire expression for the function(with one parameter)
> inside the quadgk command, but how can I do it in separate m file? -thanks
>
>>> f1(s)=quadgk((@(x)(real((x+sqrt(-1)*0.0001)./(sqrt((x+sqrt(-1)*0.0001).^2
>>> - (0.0025).^2)))).*2320*exp((x+v).*2320)./((exp((x+v).*2320 )+
>>> 1).^2)),-0.1,0.1,[],[],v);
> ??? SWITCH expression must be a scalar or string constant.
>
> Error in ==> quadgk>parseOptions at 531
> switch propname
>
> Error in ==> quadgk at 149
> parseOptions(varargin{:});
>
>>> f1(s)=quadgk((@(x)(real((x+sqrt(-1)*0.0001)/(sqrt((x+sqrt(-1)*0.0001)^2
>>> - (0.0025)^2))))*2320*exp((x+v)*2320)/((exp((x+v)*2320 )+
>>> 1)^2)),-0.1,0.1,[],[],v);
> ??? SWITCH expression must be a scalar or string constant.
>
> Error in ==> quadgk>parseOptions at 531
> switch propname
>
> Error in ==> quadgk at 149
> parseOptions(varargin{:});