matlab中的loglog图给出了log-linear

时间:2018-03-29 04:24:12

标签: matlab plot

我试图绘制两个数字。一个线性和一个loglog。由于某种原因,loglog图无法正常工作。这是我的代码:

% Define the Lamb-Oseen vortex
y = 1.0;
R = 2.5;

f = @(r) r.*((y/(pi.*(R.^2))) .* exp((-r.^2)/(R.^2)));

% Now calculate the circulation for different n
integrals = zeros(1,4);
error = zeros(1,4);
i = 1;
n = [2,3,4,5];
for k = n
    s = 2*pi*Laguerre_Quad(f, k);
    integrals(1,i) = s;

    error(i) = abs(s - y);
    i = i+1;
end


% Plot results as fcn of n
figure
plot(n,integrals,'r.', 'MarkerSize',30);
title('Calculated Integral vs N');
xlabel('n');
ylabel('Integral');

% Now plot the error as a function of n
figure
loglog(n,error,'r.', 'MarkerSize',30);
title('Error vs N');
xlabel('n');
ylabel('Error');

她是由此产生的阴谋:

图1:

fig1

图2:

fig2

当我使用loglog图时,为什么图2中的x轴(n)是线性的?

0 个答案:

没有答案