Hello, This is my 2D Plot and I can't figure out how to turn the Red curve into a 3D Plot or what the Z coordinate would even be for it. I would really appreciate some help. Here is my code for the red curve:
Receptive_Field = GME(s, sigE) - (0.5*GMI(s, sigI));
plot(s, Receptive_Field, 'r')
function E = GME(s,sigE)
E = exp(-1*(s.^2)/(2*sigE^2));
end
function I = GMI(s,sigI)
I = exp(-1*(s.^2)/(2*sigI^2));
end

 채택된 답변

darova
darova 2020년 4월 3일

0 개 추천

I made a simple example for you
x = 0:10;
y = sin(x)+2;
t = linspace(0,2*pi,30);
[T,Y] = meshgrid(t,y);
[~,X] = meshgrid(t,x);
[Z,Y] = pol2cart(T,Y);
surf(X,Y,Z,'facecolor','none')
line(x,y,'linewidth',3)
axis vis3d
Is this what are you looking for?

댓글 수: 6

Nicole Mezher
Nicole Mezher 2020년 4월 3일
Can you further explain how you got your Z coordinate, T in this case, Did you know what you wanted it to be?
darova
darova 2020년 4월 3일
This is function i choosed (use yours instead)
x = 0:10;
y = sin(x)+2;
I know that if rotate something should be an angle. I shoosed t (eg )
t = linspace(0,2*pi,30);
I want to rotate about X axis (it stays unchanged). I assumed that y plays role of radius
So we have x, y=r and t. We need a mesh to build a surface
[T,R] = meshgrid(t,y); % generate mesh for angle and radius
[~,X] = meshgrid(t,x); % generate mesh for X only
All data is prepared (X,T and R). It's in polar system of coordinates. All we need to do is to convert it cartesian
[Z,Y] = pol2cart(T,R); % convert angle and radius to cartesian system
Final part
surf(X,Y,Z,'facecolor','none') % create rotated object
line(x,y,'linewidth',3) % add thick line (original data in XY plane)
axis vis3d % adjust axes so they don't change
  • Did you know what you wanted it to be?
Sure i do. Do you? Do you have any questions?
Nicole Mezher
Nicole Mezher 2020년 4월 3일
I personally am unsure what to make my z-coordinate. All I know is the shape my current graph takes, but I am confused how to turn that into a 3D Figure, or what the new parameter would be.
darova
darova 2020년 4월 3일
So you need to rotate about Z axis?
Nicole Mezher
Nicole Mezher 2020년 4월 3일
Yes
darova
darova 2020년 4월 3일
Maybe another way. Here is my first script

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2020년 4월 3일

댓글:

2020년 4월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by