Equating and plotting the ratio of two sets of data having unequal length.

2 ビュー (過去 30 日間)
Tandra Pal
Tandra Pal 2020 年 10 月 19 日
回答済み: Andy 2020 年 10 月 20 日
Hello, I'm a beginner in matlab. I'm having problem in plotting a graph on matlab. I want to plot curve2:curve1. curve1 and curve2 has unequal length nad also the x axis is unequal. kindly help me.
curve1 curve2
x y x y
100 50 100.1 30
200 70 100.4 20
200.5 60 100.5 40
300 20 200 50
400 90

回答 (1 件)

Andy
Andy 2020 年 10 月 20 日
In the simplest form, create variables for the two curves:
data1 = [100 200 200.5 300 400;50 70 60 20 90];
data2 = [100.1 100.4 100.5 200;30 20 40 50];
% Plot the first data set with a blue line
plot(data1(1,:),data1(2,:),'b')
% Tell Matlab to keep plotting curves on the same Figure
hold on
% Plot the second data set using a red curve
plot(data2(1,:),data2(2,:),'r')
If you examine the help for plot you will find out how to set other parameters for the graph.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by