Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Pass multiple variables to quadv

Subject: Pass multiple variables to quadv

From: Steve Sachay

Date: 24 Mar, 2011 20:39:06

Message: 1 of 2

Hi. I'd like to pass variables to quadv for use in parametric fitting.

function y=my(t,a,b)
y=a.*exp(-b.*t)

>>my(1,2,3)
ans =

     0.099574

Seems to work just fine...

>> quad(@(t)my(t,2,3),b-1,b+1)
??? Undefined function or variable 'b'.

>> quad(@(t)my(1,2,3),b-1,b+1)
??? Undefined function or variable 'b'.

>> quad(@(t)my(t,2,3),b-1,b+1,[],[],2,3)
??? Undefined function or variable 'b'.
 
Tried it like this too:
my=@(a,b,c)a.*exp(-b.*c)

Thanks for any suggestions.

Subject: Pass multiple variables to quadv

From: Steve Sachay

Date: 24 Mar, 2011 20:48:23

Message: 2 of 2

Asking the newsgroup workks more often than not...

function y = e1q(a,b,t)
e1=@(a,b,t) a.*exp(-b.*t);
y =quadv(@(t)e1(a,b,t),b-3,b+3);


>> e1q(1,2,3)

ans =

       3.6945

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us