changing y axes on a loglog graph

I need to replicate the graph below using MatLab.
I've tried everything and it always gives me this graph instead:
This is my code, please let me know what I need to change, I've really tried everything possible.
y=80./sqrt(x);
plot(x,y);
xlim([1 100])
ylim([1 1000])
title('LDR Log-Log Graph of Cell Resistance vs. Illuminance')
xlabel('Illuminance [Lux]')
ylabel('Cell Resistance [Kohm]')
loglog(x,y)
grid on

回答 (1 件)

Star Strider
Star Strider 2020 年 10 月 14 日
編集済み: Star Strider 2020 年 10 月 14 日

0 投票

Add these linmes at the end of your posted code:
ylim([1 1E+3])
ytk = yticks;
yticklabels(ytk)
so the full code is now:
x = logspace(0, 2);
y=80./sqrt(x);
plot(x,y);
xlim([1 100])
ylim([1 1000])
title('LDR Log-Log Graph of Cell Resistance vs. Illuminance')
xlabel('Illuminance [Lux]')
ylabel('Cell Resistance [Kohm]')
loglog(x,y)
grid on
ylim([1 1E+3])
ytk = yticks;
yticklabels(ytk)
producing:
EDIT — Added plot figure.

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

質問済み:

2020 年 10 月 14 日

編集済み:

2020 年 10 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by