Is it possible to use surf function calling parameters from a 4-D matrix?
조회 수: 5 (최근 30일)
이전 댓글 표시
I have an equation which is a fn of four variables. So i created a 4-D matrix to calculate an output, ie Output=f(a,b,c,d) inside a multi for loop of 4.
Now I wish to use the surf command to plot Output as fn of any above 2 variables.
It seems I can only plot a surface if the matrix is of the form Output=f(a,b,c), ie
surf(a,b,output(:,:,1,1)
It does not accept any other variation like
surf(a,b,output(1,:,:,1) etc
So am i restricted to Output=f(a,b,c) inside the for loop?
Thanks in advanced
댓글 수: 0
채택된 답변
Wayne King
2013년 9월 29일
You can use squeeze() to do this
output = randn(20,20,20,20);
surf(squeeze(output(1,:,:,1)))
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!