Clear Filters
Clear Filters

How to plot a simple expression in matlab

1 view (last 30 days)
lakom Mariem
lakom Mariem on 14 Nov 2017
Commented: Rik on 14 Nov 2017
Hello everyone Please I need your help..I'm new in matlab and i have problem in plotting curves..... I have a curve already plotted and i have to reproduce it.I have this data : the function is y=1/(2^(K-1)) (K var) The x axis is [0:5:50] The y axis is [10^(-5):10^(-1):10^(0)] the figure is below.I have to plot the curve for "OW" (blue sky) Anyone please can help me and thanks in advance.
  5 Comments
Rik
Rik on 14 Nov 2017
Edited: Rik on 14 Nov 2017
The best help I can give you is to tell you to do a tutorial before you try some random code you found. That last link I gave you also contains helpful advice (like e.g. to select you code and hit the {}Code button to correctly format code).
You should not use plot inside a loop if you want to plot a single line.
Rik
Rik on 14 Nov 2017
I don't know what your goal is with sending me the e-mail you did. You're the one asking for help. You've been working with Matlab for at least 8 months now, so you had time enough to learn the tool you are using. The code below should be trivial to come up with if you have done any tutorial worth its salt.
K=1:4;
y= 1./(2.^(K-1));
semilogy(K,y,'--')
ytickvals=10.^(-5:1:0);
yticks(ytickvals)
ylim([min(ytickvals) max(ytickvals)])
grid on
If you want any help from someone, I would suggest not hitting send on an e-mail that contains a sentence like "Me too i can advise you to learn english so you can write a simple sentence correctly."

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!