How can I isolate a segment of ECG data in MATLAB?

In summary, the conversation discusses how to plot a signal in a time domain using MATLAB. The signal being plotted is an ECG data file that is imported. The focus is on isolating a specific segment of the data, specifically the heartbeats from time 50-60. The conversation includes a suggested solution that uses the "find" function to isolate the desired segment and plot it. The conversation also mentions the frustration of not knowing the correct terminology to search for help and asks for suggestions on where to learn signals and systems through self-study.
  • #1
TomUIC
5
0
I have inputed the following, I was given a signal and told to plot it in a time domain. The signal ECG is a data file and imported.

N = 15000;
fs = 250;
t = linspace(0, 60, N);
%signal = ecg data = ecg

subplot (2,1,1);
plot (t,ecg);
title ('Time-Domain ECG')
xlabel ('Time (s)')
ylabel ('Magnitude')

The above works just fine, but I wish to focus on a part of the data.

The problem is I do not know how to isolate a segment of the data, I'm not very experienced in MATLAB. The data represents heartbeats, and my goal is to plot one from the raw data, say for instance from time 50-60.

I had thought perhaps the following would work:

plot (t(50:60),ecg(my start point:end);

Obviously it does not, so I'm asking for some help.
 
Physics news on Phys.org
  • #2
Try this Tom
Code:
idx = find(t>50 & t<60);
plot(t(idx),ecg(idx))
 
  • #3
Thank you very much, you have ended a great deal of frustration for what amounted to a simple problem. I hate knowing what you want to do but not knowing the correct terminology to search for the help. I doubt this class will teach me much about signals and systems in the end, but I think I'll be better at MATLAB for my trouble.

Any suggestions on where to actually learn signals and systems would be appreciated, in terms of self-study.
 

1. What is Matlab and how is it used in signal processing?

Matlab is a programming language and environment commonly used in scientific and engineering fields. It is particularly useful in signal processing as it offers a variety of tools and functions for analyzing, visualizing, and manipulating signals.

2. How can Matlab help with signal filtering?

Matlab has built-in functions for implementing various types of filters, such as low-pass, high-pass, and band-pass filters. These functions allow for easy and efficient filtering of signals to remove noise or unwanted frequencies.

3. Can Matlab be used for real-time signal processing?

Yes, Matlab has the capability to handle real-time signal processing. This can be achieved by using the real-time toolbox, which allows for the acquisition and processing of signals in real-time.

4. What are the advantages of using Matlab for signal processing over other languages?

One advantage of using Matlab for signal processing is its extensive library of built-in functions and tools specifically designed for signal analysis. Additionally, Matlab has a user-friendly interface and syntax, making it easier for beginners to learn and use.

5. Are there any limitations to using Matlab for signal processing?

While Matlab has many useful features for signal processing, it does have some limitations. For example, it may not be the best choice for large-scale or complex signal processing tasks, as it can be computationally intensive and may require additional toolboxes or add-ons.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
737
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Back
Top