How to plot a 4D matrix, variable-by-variable?

2 vues (au cours des 30 derniers jours)
Darcy
Darcy le 18 Jan 2013
I have a 4D matrix of a mathematical function of the form R(x,y,z,t). I want to plot a variety of different things on 2D plots using the plot function. I want to plot a graph of R vs. x at a specified y,z and t. In other words:
plot(R(:,35,1,1))
This command works fine and it outputs a figure showing all the x-coordinates through the planes y=35,z=1 and t=1.
I've done the same thing for R vs. y: plot(R(35,:,1,1)).
However, what I REALLY want to do is make a plot of R vs. t. This graph would show the variation in R through time at a specific point P(x,y,z).
So I tried using plot:
plot(R(35,35,1,:))
but I get an error saying: Error using plot Data may not have more than 2 dimensions
Is there a simple solution to plot R vs t given a 4D matrix?
Thanks

Réponses (1)

Walter Roberson
Walter Roberson le 18 Jan 2013
plot(squeeze(R(35,35,1,:)))

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by