Clear Filters
Clear Filters

How to draw a combination curve from data points of two curves with same axes ?

1 view (last 30 days)
i have data points of two curves with same axes to be drawn in MATLAB. Morever, I need to draw one more curve using all data points of previous two curves with same axes. How can i draw the third curve using all data points of the first two curves? and then, how to find the lowest point of the third curve? I want all of three curves are on one figure. Please give me suggestion.

Accepted Answer

Adam Danz
Adam Danz on 21 Aug 2018
If your two curves are stored as vectors in variables x1, y1, x2, y2, and you've plotted
figure
plot(x1,y1)
hold on
plot(x2,y1)
then to combine (x1,y1) and (x2,y2) into a 3rd curve,
x3 = [x1, x2]; %for row vectors; if column vecs, [x1;x2]
y3 = [y1, y2];
plot(x3,y3)
The lowest point along the y axis in curve #3 is
[minVal, minIdx] = min(y3)
  5 Comments
Adam Danz
Adam Danz on 23 Aug 2018
Glad that helped! About your new question, it's best to write a new question on the forum rather than continuing this one since the topic is different. To partially answer the question, it depends on what type of data is being stored in the txt files. Is it strings? numerical matrices? etc.
But first just try searching for the answer because this has been addressed many times.

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots 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!