フィルターのクリア

Plotting a continuous line from separate data files

2 ビュー (過去 30 日間)
Connor Burchell
Connor Burchell 2020 年 1 月 23 日
回答済み: Jesus Sanchez 2020 年 1 月 23 日
Having an issue with some velocity profile plots I am trying to make. I have 9 data files, and have been plotting using the very basic code below. Only, the plot generated has 9 different line segments which do not connect and have different colours. I would like to plot one continuous line in a single colour. Can anyone offer any insight?
clearvars
folder = xxxxxxxxxx
file = '20percent_00_20.185.19.Vectrino Profiler.00000.mat';
load(fullfile(folder, file))
U00 = Data.Profiles_VelX;
clear Data Config file
file = '20percent_20_40.185.19.Vectrino Profiler.00000.mat';
load(fullfile(folder, file))
U20 = Data.Profiles_VelX;
clear Data Config file
file = '20percent_40_60.185.19.Vectrino Profiler.00000.mat';
load(fullfile(folder, file))
U40 = Data.Profiles_VelX;
clear Data Config file
file = '20percent_60_80.185.19.Vectrino Profiler.00000.mat';
load(fullfile(folder, file))
U60 = Data.Profiles_VelX;
clear Data Config file
file = '20percent_80_100.185.19.Vectrino Profiler.00000.mat';
load(fullfile(folder, file))
U80 = Data.Profiles_VelX;
clear Data Config file
file = '20percent_100_120.185.19.Vectrino Profiler.00000.mat';
load(fullfile(folder, file))
U100 = Data.Profiles_VelX;
clear Data Config file
file = '40percent_120_140.185.19.Vectrino Profiler.00000.mat';
load(fullfile(folder, file))
U120 = Data.Profiles_VelX;
clear Data Config file
file = '20percent_140_160.185.19.Vectrino Profiler.00000.mat';
load(fullfile(folder, file))
U140 = Data.Profiles_VelX;
clear Data Config file
file = '20percent_160_180.185.19.Vectrino Profiler.00000.mat';
load(fullfile(folder, file))
U160 = Data.Profiles_VelX;
clear Data Config file
file = '20percent_160_180.185.19.Vectrino Profiler.00000.mat';
load(fullfile(folder, file))
U180 = Data.Profiles_VelX
U = [U00 U20 U40 U60 U80 U100 U120 U140 U160 U180];
figure;
plot(fliplr(median(U00)),0:1:20); hold on;
plot(fliplr(median(U20)),20:1:40); hold on;
plot(fliplr(median(U40)),40:1:60); hold on;
plot(fliplr(median(U60)),60:1:80); hold on;
plot(fliplr(median(U80)),80:1:100); hold on;
plot(fliplr(median(U100)),100:1:120); hold on;
plot(fliplr(median(U120)),120:1:140); hold on;
plot(fliplr(median(U140)),140:1:160); hold on;
plot(fliplr(median(U160)),160:1:180);hold on;
plot(fliplr(median(U180)),180:1:200);hold on;
figure
hold on
ylim([0 200])
%U00
plot(fliplr(U00), 00:20)
plot(median(fliplr(U00)), 00:20, '-k', 'LineWidth', 3)
%U20
plot(fliplr(U20), 10:30)
plot(median(fliplr(U20)), 10:30, '-k', 'LineWidth', 3)
%U40
plot(fliplr(U40), 30:50)
plot(median(fliplr(U40)), 30:50, '-k', 'LineWidth', 3)
%U60
plot(fliplr(U60), 50:70)
plot(median(fliplr(U60)), 50:1:70, '-k', 'LineWidth', 3)
%U80
plot(fliplr(U80), 70:1:90)
plot(median(fliplr(U80)), 70:1:90, '-k', 'LineWidth', 3)
%U100
plot(fliplr(U100), 90:110)
plot(median(fliplr(100)), 90:110, '-k', 'LineWidth', 3)
%U120
plot(fliplr(U120), 110:130)
plot(median(fliplr(U120)), 110:130, '-k', 'LineWidth', 3)
%U140
plot(fliplr(U140), 130:150)
plot(median(fliplr(U140)), 130:150, '-k', 'LineWidth', 3)
%U160
plot(fliplr(U160), 150:170)
plot(median(fliplr(U160)), 150:1:170, '-k', 'LineWidth', 3)
%U180
plot(fliplr(U180), 170:1:190)
plot(median(fliplr(U180)), 170:190, '-k', 'LineWidth', 3)

採用された回答

Jesus Sanchez
Jesus Sanchez 2020 年 1 月 23 日
Combine all of them in one vector before plotting. If they are line-vectors:
x_data = [x1 , x2 , x3 ... x9];
y_data = [y1 , y2 , y3 ... y9];
plot(x_data,y_data);
If they are columns, instead of using "," to concatenate the vectors, use ";".

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by