Complex surface to plot
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hello! I need to make represent the protection surface of a lightning arrester. This means I have a vertical cube(very slim)...height = 7; sides= 0.5; I also have a radius of a circle of about 3.5; I have to intersect these and plot a surface that looks like a circus tent. It should look like the images below (a wizard's hat, if you want). Can anybody help me? Thanks a lot!
<<

>>
채택된 답변
Star Strider
2017년 6월 8일
1 개 추천
I don’t have your function to plot, so I created one. The rest of the code is (I hope) relatively straightforward to understand. I leave it to you to insert the correct structure of the lightning arrestor structure, although you may not need it since the mesh plot will obscure it. Change it as necessary to create the result you want.
The Code —
f = @(b,r) b(1).*exp(-b(2).*r); % Function Of Radius Only
a = linspace(0, 2*pi, 50); % Angle
r = linspace(0, 100, 50); % Radius
b = [30 0.05]; % Parameter Vector
[A,R] = meshgrid(a, r); % Creat Mesh Matrices
fr = f(b,R); % Evaluate Function Of ‘R’ Matrix
[xm,ym,zm] = pol2cart(A,R,fr); % Convert To Cartesian
figure(1)
mesh(xm, ym, zm)
grid on
The Plot —

댓글 수: 8
Cezar Axintescu
2017년 6월 8일
Thanks a lot!!! I cannot express how grateful I am!
As always, my pleasure!
It will look more like your original plot if you add
axis equal
after the grid on call. (I just thought of that.)
Cezar Axintescu
2017년 6월 9일
Thanks! I have another questions though. How can I change the program in order to make the margins of the tent as being part of a circle? (i tried inserting the equation of a circle/sphere somewhere but it doesn't seem to work.)
My pleasure!
I’m not certain what you want.
See if this works:
The Code —
f = @(b,r) b(1).*exp(-b(2).*r); % Function Of Radius Only
a = linspace(0, 2*pi, 75); % Angle
r = linspace(0, 100, 75); % Radius
b = [30 0.05]; % Parameter Vector
[A,R] = meshgrid(a, r); % Creat Mesh Matrices
fr = f(b,R); % Evaluate Function Of ‘R’ Matrix
[xm,ym,zm] = pol2cart(A,R,fr); % Convert To Cartesian
[Xs,Ys,Zs] = sphere;
figure(1)
mesh(xm, ym, zm, 'FaceColor','interp')
ax1 = gca;
hold on
surf(Xs*100, Ys*100, Zs*100, 'FaceAlpha', 0, 'EdgeAlpha',0.2, 'EdgeColor','k')
ax2 = gca;
hold off
grid on
axis equal
colormap(ax1, jet)
view([-40, 20])
The Plot —

Cezar Axintescu
2017년 6월 10일
f = @(b,r) b(1).*exp(-b(2).*r); This function I wanted to change it in order to create the "margins" of the tent as being part of a circle/sphere. So, the function needs to describe a circle. The problem is I don't what function. Thanks!
Star Strider
2017년 6월 10일
My pleasure.
I don’t understand what you want. Do you have an image of what you want that you could share?
Cezar Axintescu
2017년 6월 10일
I tried explaining in the picture below.
Star Strider
2017년 6월 10일
You need to provide the function you want to use. I know essentially nothing about the physics of lightning arrestors.
The best I can do is a version of the inverse-square law (that seems appropriate here):
f = @(c,r) c*(1./(1 + r/c).^2); % Function Of Radius Only
a = linspace(0, 2*pi, 50); % Angle
r = linspace(0, 100, 50); % Radius
c = 30;
[A,R] = meshgrid(a, r); % Creat Mesh Matrices
fr = f(c,R); % Evaluate Function Of ‘R’ Matrix
[xm,ym,zm] = pol2cart(A,R,fr); % Convert To Cartesian
figure(1)
mesh(xm, ym, zm)
grid on
axis equal
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
