开发者

plotting a 2D graph

开发者 https://www.devze.com 2023-02-12 05:16 出处:网络
I have 2 figures. 1 figure is called power and the other one called cost. So I want to plot cost vs power graph where cost is the y-axis and p开发者_运维问答ower is the x-axis. For example:

I have 2 figures. 1 figure is called power and the other one called cost. So I want to plot cost vs power graph where cost is the y-axis and p开发者_运维问答ower is the x-axis. For example:

Assume the result of the cost edit text box is like this:

C1 = 300
C2 = 500
CT = 800

Assume the result of the power edit text box is like this:

P1 = 120
P2 = 150
PT = 270

So I want to plot a graph from this output. For example:

P1 = 120 when C1 = 300
P2 = 150 when C1 = 500
PT = 270 when C1 = 800

For your information, the answer will only generated after I push the generate button. So what I want is, once I push the button, there will be a result at both edit text and a plot on axes figure but I don't know how to do it.


If you want to plot your data, you can simply do:

C = [C1 C2 C3];
P = [P1 P2 P3];
plot(C, P);

See e.g. http://www.mathworks.com/help/techdoc/learn_matlab/f3-27853.html for details on how to customise the plots.

0

精彩评论

暂无评论...
验证码 换一张
取 消