Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to generate such a data table?
Date: Thu, 12 Aug 2010 16:46:21 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 33
Message-ID: <i418gt$fj7$1@fred.mathworks.com>
References: <i415ha$h7q$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1281631581 15975 172.30.248.35 (12 Aug 2010 16:46:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 12 Aug 2010 16:46:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:661487

"Chen " <neversaynever@never.org> wrote in message <i415ha$h7q$1@fred.mathworks.com>...
> Dear all,
>  
>        The problem is like this:
>  
>        Lets say x = [1 2 3; 16 13 10; 4 6 8]; 
>                    y = [0.5 0.6 0.7; 1 1.2 1.4; 2 2.4 2.8];
> 
> the data is like this distributed: diff(x(1,:)) = 1; diff(x(2,:)) = 3; diff(x(3,:)) = 2;
>                                            diff(y(1,:)) = 0.1; diff(x(2,:)) = 0.2; diff(x(3,:)) = 0.4;
> 
> which means that the numbers in each row of x or y are not equally spaced neither in ascending or descending order.
> 
> the data I want to put in the new matrix  is generated like this:
> f = x.*y = [    0.5000    1.2000    2.1000
>                    16.0000   15.6000   14.0000
>                     8.0000   14.4000   22.4000];
> 
> I want to generate a new 9 X 9 matrix for f  in such a way that  both row and column are in a ascending order w.r.t x or y. 
> 
> So there are 9 elements in this 9 X 9 matrix and all these 9 elements are obtained by f = x.*y. the rest of this matrix are all zeros.
> 
> How can I do this? Thanks !
> 
> -Chen
- - - - - - - -
  You have explained the nature of your x and y arrays and how f is obtained from them in a clear manner.  From your description it can be seen that an f array of any n x n size can be generated entirely in terms of four n x 1 column vectors.

  However, you haven't explained just how x and y are allowed to be altered to make f satisfy your condition: "... generate a new 9 X 9 matrix for f in such a way that both row and column are in a ascending order w.r.t x or y."  Furthermore it isn't clear what you mean in that last part about "w.r.t x or y".  What do you mean by "with respect to x or y"?  Rows and columns are either in ascending order or they aren't.

  Can you please make another try at giving a clear explanation of what you are trying to do?

Roger Stafford