How to plot inverse power in matlab?.
Show older comments
Hi everybody, I have the following data and code such that the parameter on y-axis (Y) has inversely relation to the fifth power of parameter on x-axis (X).
X=[0.188,0.586,0.982,2.09,2.24,9.38,20.9,39.27,54];
a1=4.16*1.e-10*(0.188).^-5;
a2=4.16*1.e-10*(0.586).^-5;
a3=4.16*1.e-10*(0.982).^-5;
a4=4.16*1.e-10*(2.09).^-5;
a5=4.16*1.e-10*(2.24).^-5;
a6=4.16*1.e-10*(9.38).^-5;
a7=4.16*1.e-10*(20.9).^-5;
a8=4.16*1.e-10*(39.27).^-5;
a9=1*4.16*1.e-10*(54).^-5;
Y=[a1,a2,a3,a4,a5,a6,a7,a8,a9];
plot(X,log10(Y),'b')
set(gca,'xtick',[1 2 3 4 5 6 7 8 9]);
set(gca,'xticklabel',{'0.188','0.586','0.982','2.09','2.24','9.38','20.9','39.27','54'});%
ylabel('\fontsize{8}\fontname{Arial} Y ')
xlabel('\fontsize{8}\fontname{Arial} X ')
set(gca,'FontSize',8);
Also consider the below figure, and focus on x-ticks from 1 to 10 and from 10 to 100. As they are not equally spaced. I have also given the task to make fig from the given data and due to inverse relation of fifth power also arrange the x-axis. Now i do not understand that it will be spaced differently by default or by some logic,and does it is due the inverse relation of fifth power or whatever. any guidance will be appreciated. Noted with my given data we will have only one curve, thanks.

2 Comments
the cyclist
on 8 Jan 2018
I don't have a solution for your issue, but here is a simplification of your code:
X = [0.188,0.586,0.982,2.09,2.24,9.38,20.9,39.27,54];
Y = 4.16e-10 * X.^(-5);
figure
plot(X,log10(Y),'b')
set(gca,'xtick',1:9);
set(gca,'xticklabel',X);%
ylabel('\fontsize{8}\fontname{Arial} Y ')
xlabel('\fontsize{8}\fontname{Arial} X ')
set(gca,'FontSize',8);
Safi ullah
on 9 Jan 2018
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!