MATLAB Answers

Is it possible to plot several graphs with separate axis on the same figure? I want to compare different waveforms in one figure.

2 ビュー (過去 30 日間)
Timothy Nsubuga
Timothy Nsubuga 2019 年 6 月 19 日
function g = graphData(file)
table = readtable(file); %read the data into a table
xr = table2array(table); %convert the table into an array(matrix)
x = xr(:,1);
y = xr(:,2);
[up,lo] = envelope(y); %attain the hilbert envelope
m = [up,lo];
M = find([up,lo] == max(m)); %find the max amplitude of the hilbert transform envelope
File_names = dir('*.csv'); %attain every waveform in the event folder
numFiles = length(File_names);
hold on
for i = 1:length(numFiles)
g = plot( x,y, x, up,'-p','MarkerIndices',(M),...
'MarkerSize',10 ); %plot time vs. amplitude vs. hilbert and mark max amplitude of hilbert
xlabel('time (seconds)');
title("Peak in Hilbert Transform of Signal");

  0 件のコメント


回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by