help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem plotting "N-d object"


From: Ben Abbott
Subject: Re: problem plotting "N-d object"
Date: Mon, 20 Feb 2012 19:15:23 -0500

On Feb 20, 2012, at 4:14 PM, Pascal A. Dupuis wrote:

> On Mon, Feb 20, 2012 at 03:45:20PM -0500, Jordi GutiƩrrez Hermoso wrote:
>> On 20 February 2012 15:11, Pascal A. Dupuis
>> <address@hidden> wrote:
>>> A (1x5x1) tensor can not be added to a (1x1x5) tensor.
>> 
>> Actually, since 3.6.0, you can...
>> 
>> - Jordi G. H.
> 
> Broadcasting, indeed. Now what about N-D array plotting ?
> 
> Pascal

>> rand (5,1,1) + rand (1,5,1) + rand (1,1,5)
warning: operator +: automatic broadcasting operation applied
warning: operator +: automatic broadcasting operation applied
ans =

ans(:,:,1) =

   2.0966   2.1135   1.6748   1.7815   2.1341
   2.5315   2.5483   2.1096   2.2163   2.5689
   2.1075   2.1243   1.6856   1.7923   2.1449
   2.4381   2.4550   2.0163   2.1230   2.4756
   1.9605   1.9774   1.5387   1.6454   1.9980

ans(:,:,2) =

   1.8595   1.8763   1.4376   1.5443   1.8970
   2.2943   2.3111   1.8725   1.9791   2.3318
   1.8703   1.8872   1.4485   1.5552   1.9078
   2.2010   2.2178   1.7791   1.8858   2.2385
   1.7234   1.7402   1.3015   1.4082   1.7609

ans(:,:,3) =

   1.5947   1.6115   1.1728   1.2795   1.6322
   2.0295   2.0463   1.6077   1.7143   2.0670
   1.6055   1.6224   1.1837   1.2904   1.6430
   1.9362   1.9530   1.5143   1.6210   1.9737
   1.4586   1.4754   1.0367   1.1434   1.4961

ans(:,:,4) =

   1.6975   1.7144   1.2757   1.3824   1.7350
   2.1324   2.1492   1.7105   1.8172   2.1698
   1.7084   1.7252   1.2865   1.3932   1.7458
   2.0390   2.0559   1.6172   1.7239   2.0765
   1.5614   1.5783   1.1396   1.2463   1.5989

ans(:,:,5) =

   2.0724   2.0893   1.6506   1.7573   2.1099
   2.5073   2.5241   2.0854   2.1921   2.5447
   2.0833   2.1001   1.6614   1.7681   2.1207
   2.4139   2.4308   1.9921   2.0988   2.4514
   1.9363   1.9532   1.5145   1.6212   1.9738

I had thought broadcasting would require the dot type operator ".+" and that 
"+" would behave in a strict/pedantic manner (as with multiplication and 
division).

In any event, I do think there is a parallel to be drawn for N-d plotting. 

Ben





reply via email to

[Prev in Thread] Current Thread [Next in Thread]