A question about usage of ndgrid

Hello,
I am relatively new to MATLAB so would like to know if there is a way to invoke the ndgrid function with a set of values rather than a range, as specified in the documentation? For instance, if I had to plot five dimensions with five values like 0.5 0.3 0.675 0.987 0.1100, would I be able to do it with ndgrid? Alternatively, is there any other MATLAB function that could help me to generate a grid plot for n random data dimensions?
Greatly appreciate your thoughts.
TIA Vinod

Réponses (1)

Walter Roberson
Walter Roberson le 19 Avr 2014

0 votes

Yes, no problem. ndgrid does not ever really take ranges: the examples you look at are using operators that create sets of values from ranges and pass those sets into ndgrid.
[A, B, C, D, E] = ndgrid([0.5 0.3 0.675 0.987 0.1100]);

3 commentaires

Vinod
Vinod le 19 Avr 2014
thanks for the answer. Can I pass all the elements of the resultant grid array in your example above, [A, B, C, D, E], to the mesh function? I am unable to figure this out since in the documentation, I see that only three arguments are passed to mesh() after the processing by ndgrid:
Would you be able to clarify this doubt of mine?
TIA
Vinod
Walter Roberson
Walter Roberson le 19 Avr 2014
How do you want the 4th and 5th dimensions to be represented on the plot? Use color for the 4th dimension, and time (animation) for the 5th dimension?
Vinod
Vinod le 19 Avr 2014
thanks. color should be fine, but animation may not be an option. The plots would be sent to a publication. Even I am not sure about color, as it may not appear on b/w printouts. is there any other way to bring to the fore all the dimensions without using either color or animation? I would prefer using directional coordinates if that is an option at all, but I also understand that then the plot might be restricted to 3 dimensions. I have already plotted something using surf(), but in this case I had to do away with certain aspects of the simulation results so as to reduce it to three dimensions.
Vinod

Connectez-vous pour commenter.

Catégories

Tags

Question posée :

le 19 Avr 2014

Commenté :

le 19 Avr 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by