Can someone help me fix my axis?

2 views (last 30 days)
function [] =FFAplot(a,b,k)
a=[2000 1000 4000];
b=[30000 40000 50000];
k=[-.3 -.1 -.4];
for T=1:100
P=1/T;
Q1=b(1)+((a(1)/k(1))*(1-(-log(1-P))^k(1)));
Q2=b(2)+((a(2)/k(2))*(1-(-log(1-P))^k(2)));
Q3=b(3)+((a(3)/k(3))*(1-(-log(1-P))^k(3)));
end
figure(1)
plot(T,Q1,'b')
hold on
plot(T,Q2,'r')
plot(T,Q3,'y')
hold off
grid
axis([10^0 10^2 10^4 10^6])
xlabel('Return period(yr)')
ylabel('Flood magnitude(cfs)')
legend('stream 1','stream 2',...
'stream3','Location','NorthEast')
end
This is what my code produces, can someone help me so that the y axis will display 10^4 through 10^6 instead of 1*10^5 through 10*10^5

Accepted Answer

Rik
Rik on 29 Jan 2018
You may notice that the 0 on the y-axis is not there is your screenshot. Because 10^4 to 10^6 is such a wide range, you don't notice that the limits are indeed what you have set them to. You can explicitly show this by calling set(gca,'YScale','log'), or if you are running R2016b or later you can also call xtickformat('%.1e')
  1 Comment
Blake Cartwright
Blake Cartwright on 29 Jan 2018
The set(gca,'Yscale','log') was exactly what I needed, thanks a lot!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!