2D graph help

1 Ansicht (letzte 30 Tage)
Yellow Canary
Yellow Canary am 23 Jan. 2016
Kommentiert: Yellow Canary am 11 Feb. 2016
Hello,
I am getting an error. When I tried to plot these P1 and P2 function on the same graph. Can anyone help me for the code that I need to use? My code file is attached and it is working fine. I just need to add a plot.
  3 Kommentare
Yellow Canary
Yellow Canary am 24 Jan. 2016
What should I do to make it more interesting? Plot has 1275 points, not two. Did you run the code?
Image Analyst
Image Analyst am 24 Jan. 2016
Yes, but nothing happens. There is no call to plot() in the code. Please post the entire code, not a snippet that doesn't show what you want to show.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jeevan Joishi
Jeevan Joishi am 27 Jan. 2016
Based on your sample code and the description of your question above, I understand that you would like to plot the values of variables P1 and P2 that is gathered for the complete iteration of the loop.
At the present instance, the values of the variable P1 and P2 are overridden in each iteration of the loop and hence the final values in P1 and P2 are simply single values as opposed to an array. There are two ways of going about it -
1) It appears that the table is infact storing the values of P1 and P2 after each iteration. Here P1 is stored in the third column and P2 is recorded in the fourth column of the table. These values can be used to plot as follows -
>> plot(table(:,3))
>> hold on
>> plot(table(:,4))
2) Another possible approach is to change all declarations of P1 and P2 to P1(i) and P2(i) in the loop, excluding the declaration where P1 and P2 are concatenated into P, and plot these values after the script executes. The following command should plot the complete values of P1 and P2.
>> plot(P1)
>> hold on
>> plot(P2)
Drop a comment if I have misunderstood your question or up-vote if it works for you.
  1 Kommentar
Yellow Canary
Yellow Canary am 11 Feb. 2016
Hello,
I am trying to plot 3d scattered data as a 2d scatterplot with the third dimension being displayed as color or a line that separates the value of the two functions (for example, the higher value and lower value at that point). I have two functions and several parameters that are constant. Here, I want to use P[A] on the x-axis, and P[B] on the y-axis. P[A] and P[B] are probability values and P[B] is between 0 to 0.50 with 0.01 increments, while P[A] is always less than P[B].
Example;
P[A] := 0 ..P[B]-0.01
P[B] := 0 ..0.50
YC

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Discrete Data Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by