plotting help needed (increasing resolution)

조회 수: 4 (최근 30일)
dulanga
dulanga 2019년 4월 21일
댓글: Walter Roberson 2019년 4월 21일
this is my code how would i increase the resolution of the graph?
N = 101;
tmin = 0;
tmax = 3;
t = linspace(tmin,tmax,N);
x=2*cos(2*pi*t)+0.4*sin(16*pi*t);
y=4*sin(2*pi*t)+0.2*cos(16*pi*t)+t;
z=0.1*cos(16*pi*t)+t;
plot3(x,y,z)

채택된 답변

Walter Roberson
Walter Roberson 2019년 4월 21일
Increase N, so that more t values are used.
  댓글 수: 2
dulanga
dulanga 2019년 4월 21일
is there any other way to increase the resolution? it is told in the assignment that i should use N as 101
Walter Roberson
Walter Roberson 2019년 4월 21일
What kind of "resolution" do you mean for this purpose?
If you print() the figure, then for most drivers you can use a '-r' option to specify a resolution. For example
print(gcf, 'MyOutput.png', '-dpng', '-r300');
in order to construct an output image with a resolution of 300 dots per inch (based upon the PaperSize property of the current figure.)
If you mean a plot that is more accurate, less approximate, then you could break your range into multiple sections using your mandatory N for each one. This might satisfy the rule but would certainly violate the spirit of the restriction, as it is directly equivalent to using a higher N.
Other than that.. well, you could use the symbolic toolbox so that there was less numeric approximation on terms like cos(2*pi*t) when t is an integer. You will find, though, that you would have to zoom into the plot quite a bit in order to see the difference, that for any finite display size that you are likely to have access to that it would turn out the same.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by