How to make this plot smoother?

조회 수: 3 (최근 30일)
Ellen De Jonghe
Ellen De Jonghe 2020년 1월 14일
답변: Ellen De Jonghe 2020년 1월 14일
Hye, I have to replicate the following plots (it's homework).
I have to use fplot and an anonymous function for the left one and plot for the right one.
I made this script:
subplot(1,2,1) %eerste subplot, 1 rij 2 kolommen
f = @(x) sin(5.*x)./x-cos(x./3); %Anonieme functie
fplot(f, [-5,5])%fplot, interval meegeven
title('sin(5t)/t - cos(t/3)')
xlabel('t')
ylabel('y(t)')
subplot(1,2,2) %tweede subplot
a = 1/4;
b = 4;
x = linspace(0,4,10^8); %punten tussen 0 en 4
y = (b./x).*exp(-(log(x)./a).^2);
plot(x,y) %Plot met blauwe volle lijn
axis([0, 4, 0, 5])
title('(b/x)e^{ln(x)/a^{2}}')
xlabel('x')
ylabel('f(x)')
legend('(a,b) = (1/4,4)', 'Location', 'north')
But my graphs aren't smooth like the example.
How can I make them smoother?
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 1월 14일
The results look fine to me when I test, especially if I make the figure size a little bigger than the default.
WalterWhite
WalterWhite 2020년 1월 14일
The graphs look excatly like the example when i run your script. I don't see a problem

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

답변 (1개)

Ellen De Jonghe
Ellen De Jonghe 2020년 1월 14일
It's superweird but when I first plotted it, it wasn't as smooth as if I plot i now...
Sorry guys!

카테고리

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