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

조회 수: 1 (최근 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 CenterFile Exchange에서 2-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