Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
Darcy
Darcy am 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

Antworten (1)

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

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by