Equating and plotting the ratio of two sets of data having unequal length.
1 次查看(过去 30 天)
显示 更早的评论
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
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!