Path: news.mathworks.com!not-for-mail
From: "Dan Haeg" <haegd@msoe.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to generate data by Matlab?
Date: Fri, 26 Oct 2007 00:38:40 +0000 (UTC)
Organization: Milwaukee School of Engineering
Lines: 25
Message-ID: <ffrcug$qpj$1@fred.mathworks.com>
References: <ffqtva$bpk$1@fred.mathworks.com>
Reply-To: "Dan Haeg" <haegd@msoe.edu>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1193359120 27443 172.30.248.37 (26 Oct 2007 00:38:40 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 26 Oct 2007 00:38:40 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 475291
Xref: news.mathworks.com comp.soft-sys.matlab:434684



"Hero Lee" <hero@mathworks.com> wrote in message
<ffqtva$bpk$1@fred.mathworks.com>...
> Dear Sir or Madam,
> 
> I'm just a beginner on Matlab, and would like to generate
> data from a function by Matlab.
> 
> The Function is:
> Y=f(x1,x2)=[1+(x1)^-2+(x2)^-1.5]^2
> where x1 is belonged to [1,5],
>       x2 is belonged to [1,5].
> 
> How can I do if I want to generate 200 data from this
> function by Matlab. If it's available, could you kindly
> describe the codes of Matlab? Really thank you so much.
> 
> Cheers
> 
does this work?

Y=@(x1,x2) (1+x1.^-2+ x2.^-1.5).^2;
d = linspace(1,5,200);
[x,y] = meshgrid(d);

Y(x,y); %here is your 200 x 200 matrix