이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
How can I plot 3D surface x^3 + y^3 + z^3 = 1, where x, y, z are in unit closed interval in MATLAB ?.
조회 수: 10 (최근 30일)
이전 댓글 표시
I want to plot a surface x^3 + y^3 + z^3 = 1, where x, y, z are in unit closed interval. The MATLAB is not displaying the plot. Perhaps there occur some complex roots. Please help me to write its code. Thanks in advance.
채택된 답변
madhan ravi
2018년 11월 11일
편집: madhan ravi
2018년 11월 11일
syms x y z
fimplicit3(x^3+y^3+z^3==1,[-1 1 -1 1 -1 1])
댓글 수: 11
Amna Habib
2018년 11월 11일
편집: madhan ravi
2018년 11월 11일
---------------------------------------------------------------------------------------------
MATLAB Version: 8.5.0.197613 (R2015a)
MATLAB License Number: ••••••
Operating System: Microsoft Windows 8.1 Pro Version 6.3 (Build 9600)
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) Client VM mixed mode
---------------------------------------------------------------------------------------------
MATLAB Version 8.5 (R2015a)
Simulink Version 8.5 (R2015a)
Communications System Toolbox Version 6.0 (R2015a)
Computer Vision System Toolbox Version 6.2 (R2015a)
Control System Toolbox Version 9.9 (R2015a)
Curve Fitting Toolbox Version 3.5.1 (R2015a)
DO Qualification Kit Version 2.5 (R2015a)
DSP System Toolbox Version 9.0 (R2015a)
Data Acquisition Toolbox Version 3.7 (R2015a)
Database Toolbox Version 5.2.1 (R2015a)
Datafeed Toolbox Version 5.1 (R2015a)
Econometrics Toolbox Version 3.2 (R2015a)
Embedded Coder Version 6.8 (R2015a)
Filter Design HDL Coder Version 2.9.7 (R2015a)
Financial Instruments Toolbox Version 2.1 (R2015a)
Financial Toolbox Version 5.5 (R2015a)
Fixed-Point Designer Version 5.0 (R2015a)
Fuzzy Logic Toolbox Version 2.2.21 (R2015a)
Gauges Blockset Version 2.0.9 (R2015a)
Global Optimization Toolbox Version 3.3.1 (R2015a)
HDL Coder Version 3.6 (R2015a)
HDL Verifier Version 4.6 (R2015a)
IEC Certification Kit Version 3.5 (R2015a)
Image Acquisition Toolbox Version 4.9 (R2015a)
Image Processing Toolbox Version 9.2 (R2015a)
Instrument Control Toolbox Version 3.7 (R2015a)
LTE System Toolbox Version 2.0 (R2015a)
MATLAB Coder Version 2.8 (R2015a)
MATLAB Compiler Version 6.0 (R2015a)
MATLAB Compiler SDK Version 6.0 (R2015a)
MATLAB Distributed Computing Server Version 6.6 (R2015a)
MATLAB Report Generator Version 4.1 (R2015a)
Mapping Toolbox Version 4.1 (R2015a)
Model Predictive Control Toolbox Version 5.0.1 (R2015a)
Model-Based Calibration Toolbox Version 4.8.1 (R2015a)
Neural Network Toolbox Version 8.3 (R2015a)
OPC Toolbox Version 3.3.3 (R2015a)
Optimization Toolbox Version 7.2 (R2015a)
Parallel Computing Toolbox Version 6.6 (R2015a)
Partial Differential Equation Toolbox Version 2.0 (R2015a)
Phased Array System Toolbox Version 3.0 (R2015a)
Polyspace Bug Finder Version 1.3 (R2015a)
Polyspace Code Prover Version 9.3 (R2015a)
Robotics System Toolbox Version 1.0 (R2015a)
Robust Control Toolbox Version 5.3 (R2015a)
Signal Processing Toolbox Version 7.0 (R2015a)
SimElectronics Version 2.7 (R2015a)
Simscape Version 3.13 (R2015a)
Spreadsheet Link EX Version 3.2.3 (R2015a)
Stateflow Version 8.5 (R2015a)
Statistics and Machine Learning Toolbox Version 10.0 (R2015a)
Symbolic Math Toolbox Version 6.2 (R2015a)
System Identification Toolbox Version 9.2 (R2015a)
SystemTest Version 2.6.9 (R2015a)
Trading Toolbox Version 2.2 (R2015a)
Vehicle Network Toolbox Version 2.4 (R2015a)
Vision HDL Toolbox Version 1.0 (R2015a)
Wavelet Toolbox Version 4.14.1 (R2015a)
madhan ravi
2018년 11월 11일
I suggest you to upgrade to 2016b or later because fimplicit3 was introduced in 2016b see https://www.mathworks.com/help/matlab/release-notes.html?rntext=fimplicit3&startrelease=R2015a&endrelease=R2018b&groupby=release&sortby=descending&searchHighlight=
Amna Habib
2018년 11월 11일
Ok Thanks. But this is not an implicit function ever. Can you tell another command instead fimplicit3 for my version.
madhan ravi
2018년 11월 11일
"But this is not an implicit function ever
It is! you need to know the difference between implicit and explicit function first before plotting.
x^2+y^2=1 is an implicit function
x=+-sqrt(1-x^2) is an explicit function
"Can you tell another command instead fimplicit3 for my version."
without this function I suspect it would be hard to construct the surface
Bruno Luong
2018년 11월 11일
편집: madhan ravi
2018년 11월 11일
Thanks
madhan ravi's reply: Anytime :) @Bruno
추가 답변 (1개)
Bruno Luong
2018년 11월 11일
[x,y,z]=ndgrid(linspace(-1,1,33));
v=x.^3+y.^3+z.^3-1;
close all
p = patch(isosurface(x,y,z,v,0));
p.FaceColor = 'red';
daspect([1 1 1])
view(120,-30);
axis tight
camlight
lighting gouraud
댓글 수: 15
madhan ravi
2018년 11월 11일
cool @Bruno may I know how did you attach your image as an image instead of an attachment , I don't know how to attach an image not being an attachment?
Bruno Luong
2018년 11월 11일
편집: Bruno Luong
2018년 11월 11일
I use the button "image" on the left of "attach file" button.
Amna Habib
2018년 11월 11일
Very nice. I need this surface only in first octant, that is, all x, y and z varies from 0 to 1. Is only this change is require for it? [x,y,z]=ndgrid(linspace(0,1,33)) I am not expert in MATLAB till now.
Amna Habib
2018년 11월 11일
Please find attached file. I want to compare the spaces covered by respective surfaces. They are not clear yet. How can I remove their mesh?
Bruno Luong
2018년 11월 11일
To remove the mesh set
h.LineStyle = 'none';
[x,y,z]=ndgrid(linspace(-1,1,65));
close all
ptab = [1 1.5 2 3 4];
for k=1:length(ptab)
p = ptab(k);
v = abs(x).^p+abs(y).^p+abs(z).^p-1;
subplot(2,2,k);
h = patch(isosurface(x,y,z,v,0));
h.FaceColor = 'red';
h.LineStyle = 'none';
daspect([1 1 1])
view(75,20);
axis tight
camlight
lighting gouraud
title(sprintf('Sphere in l_{%g}', p));
end
Amna Habib
2022년 7월 26일
i need help in plotting the function 'g'. Can you please correct this code.
I would be very thankful to you.
x = linspace(0, 1 );
f = @(x) (x<0.5) .* (7-3.* sqrt(-2.* (log(2.*x)))) + (x>=0.5).*(7+2.* sqrt(-2.* (log(2-(2.*x)))));
g = @(x) (x<0.5).* (7-5.* sqrt(-1.* (log(2-(2.*x))))) + (x>=0.5).*(7+4.* sqrt(-1.* (log(2.*x))));
figure
plot(x, [f(x); g(x)], 'linewidth', 1.5 )
Warning: Imaginary parts of complex X and/or Y arguments ignored.
Les Beckham
2022년 7월 26일
편집: Les Beckham
2022년 7월 26일
It depends on what you really want to plot. g(x) is complex. In a 2d plot you can't plot a complex vector against a real vector. So, you have a few choices (ignoring f(x) which seems to be plotting just fine):
x = linspace(0, 1 );
g = @(x) (x<0.5).* (7-5.* sqrt(-1.* (log(2-(2.*x))))) + (x>=0.5).*(7+4.* sqrt(-1.* (log(2.*x))));
figure
plot(g(x), 'linewidth', 1.5) % plot the imaginary part of g(x) against the real part
xlabel 'real(g(x))'
ylabel 'imag(g(x))'
grid on
figure
plot(x, abs(g(x)), 'linewidth', 1.5) % plot the magnitudes of g(x) against x
xlabel 'x'
ylabel 'abs(g(x))'
grid on
figure
plot(x, angle(g(x)), 'linewidth', 1.5) % plot the phase angles of g(x) against x
xlabel 'x'
ylabel 'angle(g(x))'
grid on
figure
% plot the real part of g(x) against x; note that this is what you got
% above, plot defaults to plotting the real part and throws away the
% imaginary part
plot(x, real(g(x)), 'linewidth', 1.5)
xlabel 'x'
ylabel 'real(g(x))'
grid on
figure
plot(x, imag(g(x)), 'linewidth', 1.5) % plot the imaginary part of g(x) against x
xlabel 'x'
ylabel 'imag(g(x))'
grid on
Amna Habib
2022년 7월 26일
Thanks a lot @Les Beckham
I got this point. I appreciate your effort. Well explained!
Amna Habib
2022년 7월 26일
if you feel easy please check this code too. This function is very simple but graph is different as compared to my manual calculations.
Thank you very much for your kindness!
x = linspace(0, 1 ).';
f = @(x) (x<0.5) .* (30.*x) + (x>=0.5).* (70.*x)-20 ;
g = @(x) (x<0.5).* 30.*(1-x) + (x>=0.5).* 50-(70.*x ) ;
figure
plot(x, [f(x), g(x)], 'linewidth', 1.5 )
Torsten
2022년 7월 26일
Maybe you mean
x = linspace(0, 1,100 ).';
f = @(x) (x<0.5) .* (30.*x) + (x>=0.5).* (70.*x-20 );
g = @(x) (x<0.5).* (30.*(1-x)) + (x>=0.5).* (50-70.*x ) ;
figure
plot(x, [f(x), g(x)], 'linewidth', 1.5 )
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
태그
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)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)