Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Calculating a function
Replies: 6   Last Post: Mar 5, 2014 6:01 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Derek Goring

Posts: 3,919
Registered: 12/7/04
Re: Calculating a function
Posted: Mar 4, 2014 7:46 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Wednesday, March 5, 2014 1:30:11 PM UTC+13, canon wrote:
> Hi There
>
>
>
> I have a function f(x,y) and x=[a,b] and y=[c,d]. a, b, c and d are discrete variables. My question is I have to combine variable a,b, c and d and for each pair of (x,y) calculate f. How can I do that?
>
>
>
> Thanks


It depends whether the function will accept x and y as scalars or vectors or matrices.
If it will accept matrices, it's easy:
x=linspace(a,b,nx); % nx is the no of points in x
y=linspace(c,d,ny); % ny is the no of points in y
[X,Y]=meshgrid(x,y);
out=f(X,Y);



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.