how to project images on the side walls of a 3D surf plot

USing for example the next surf plot:
[X,Y,Z] = peaks(30);
surfc(X,Y,Z)
(in my script, X, Y and Z are vectors)
I would like to complete the next 2 tasks:
a. to project an image into one of the side walls which are white. b. to have the projection of the Z-X array (2D plot) in the other white side wall.
Is that possible? If yes, any help or idea is more than welcome. thank you,

 채택된 답변

Sven
Sven 2014년 2월 27일
편집: Sven 2014년 2월 27일
Hi Konstantinos,
Does this code get you on your way?
R = 0:0.1:1;
z = cos(-R); % that'd be your current y-function
th = 0:pi/20:2*pi;
X = bsxfun(@times,R',cos(th)) + 1;
Y = bsxfun(@times,R',sin(th)) + 1;
Z = repmat(z',1,length(th));
clf,surf(X,Y,Z)
box
hold on
axis image
C = surfc(Z,X,Y);
delete(C(1))
for i = 2:length(C)
Ch = C(i);
set(C(i),'ZData',get(C(i),'XData'))
set(C(i),'XData',get(C(i),'XData')*0)
end
If that's not what you're looking for, can you elaborate on the question?
Thanks, Sven.

댓글 수: 9

K.
K. 2014년 2월 27일
편집: K. 2014년 2월 27일
http://www.mathworks.com/matlabcentral/answers/119150-surface-evolution-of-2-arrays-in-3d the above link is my previous post, for getting a idea what 2D and 3D plot I have, and how I use the surf function. Please if you check this code, could be suggest an idea or a small script which I can use as reference?
I've updated my answer. Still not 100% sure if that's what you're trying to do.
K.
K. 2014년 2월 27일
편집: K. 2014년 2월 27일
Thank you for your reply and answer. I tried your code on my code ( add the last line of your code ). I am taking as result a surface on the opposite side of the white side wall. Also, I do not wish a surf, just a 2D projected in the white wall ( only the perimeter ) as the 2D graph on my previous post. And on the other side wall I wish to project a image. I changed the parameter 1 (1,Y,Z) to -1, and the issue with the white side wall solved; seems nice,just I would like to have the option of not a surface ( lighter process ) just 2D graph. Image is impossible? for the other issue.
I've updated the answer again. Note that the picture you gave showed nothing on "side walls". I presume you just mean that you want contours returned from surfc projected on the XY plane?
K.
K. 2014년 2월 27일
편집: K. 2014년 2월 27일
Yes. you have right. I tried your update and I get error about the plot3(Xline*0,Xline,Yline) (vectors must be in the same length). In my case, the z has size 1 291, and Xline is 1 21, Yline 1 581.
Sven
Sven 2014년 2월 27일
편집: Sven 2014년 2월 27일
Konstantinos, the code I wrote is based on a synthetic example because your actual question ("X, Y, and Z are vectors") did not match your question's code (where X, Y, and Z were matrices).
The code I wrote works fine copy/pasted into a MATLAB window. It shows how to put contour lines that were on the XY plane and instead display them on the XZ plane. The plot3() lines were just hints to show you how to plot a line that is not just on the XY plane. I have removed it now from the answer for clarity. I hope that my answer helped answer your original question. If so, please consider hitting "accept".
Remember though that it will be up to you to understand the code and use it for another purpose - keep in mind that there is absolutely no way I can make this code work for your own data if that data is completely different to the information you have provided in your question.
K.
K. 2014년 2월 27일
편집: K. 2014년 2월 27일
Sven thank you for your time to help on this. I really appreciate it. I am newbie working on Matlab and I am kinda confused. In my code I have 2D time plot and lately a 3D surface evolution animation in time. What I was looking for, it was to combine these two plots. i.e. in the side wall of the 3D surf to have the 2D lines as the previous post (n times as the the number of the loops). I will try to work more with your code. Thank you.
figure(1) surf(x,y,Lfr) xlabel('r_w[m]=radius of wire') ylabel('d[m]=distance between wires') zlabel('Inductance[H]') title('Partial Mutual-Inductance for Round Cross Section Wire') hold on for X=0.001:0.001:0.05; plot3(0*ones(size(rw)),d,(u0/(2*pi))*L*(log((L./(d+X))+sqrt((L./(d+X)).^2+1))+((d+X)./L)-sqrt(1+((d+X)./L).^2))) hold on end

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Blue에 대해 자세히 알아보기

질문:

K.
2014년 2월 27일

댓글:

2018년 9월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by