필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
Darcy
Darcy 2013년 1월 18일
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

답변 (1개)

Walter Roberson
Walter Roberson 2013년 1월 18일
plot(squeeze(R(35,35,1,:)))

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by