From: Natalie Rudolph on
Hi,
I think this is quite a simple problem for an experienced Matlab user - but I just started.
I have two for-loops that calculate a variable a in a temperature range from 280-320C and input the result in the second loop that calculates viscosities in a shear rate range from 20-100000.
To plot all results in a single diagram I found the "hold on" expression.

for T=280:5:320;
%calculates log aT
A=(((8.86*(p4-p5))/(101.6+p4-p5))-((8.86*(T-p5))/(101.6+T-p5)));
a=10^A;

%calculates viscosity from shear rate 20 to 100,000 1/s for a given
%temperature T and plots the result
for g=20:10:100000;
h=(p1*a)/((1+p2*a*g)^p3);
hold on
plot(g,h)
end
end
hold off
xlabel('shear rate (1/s)');
ylabel('viscosity (Pas)');
grid on;

However, when I use "loglog(g,h)" it only plots a graph with linear XY-axes.
Any suggestions?
Thanks,
Natalie
From: Walter Roberson on
Natalie Rudolph wrote:
> Hi,
> I think this is quite a simple problem for an experienced Matlab user -
> but I just started.
> I have two for-loops that calculate a variable a in a temperature range
> from 280-320C and input the result in the second loop that calculates
> viscosities in a shear rate range from 20-100000.
> To plot all results in a single diagram I found the "hold on" expression.

> However, when I use "loglog(g,h)" it only plots a graph with linear
> XY-axes.
> Any suggestions?

Instead of using loglog(), I suggest you set the axis XScale or YScale
property to 'log' instead of its default 'linear'.

set(gca, 'YScale', 'log')
From: Natalie Rudolph on
> Instead of using loglog(), I suggest you set the axis XScale or YScale
> property to 'log' instead of its default 'linear'.
>
> set(gca, 'YScale', 'log')

That perfectly works.
Thank you!