Select Page

need a help with matlab.please take a look and help me out if you are familiar with this question
hw_10_copy.docx
Unformatted Attachment Preview
Questions:
———1. (1 point) Consider the data shown below for patients 59,
60 and 61 of the PTB Diagnostic ECG Database (available
online at: https://physionet.org/content/ptbdb/1.0.0/):
Patient 59:
age: 63
sex: female
Acute infarction (localization): infero-lateral
Smoker: no
Number of coronary vessels involved: 1
Patient 60:
age: 54
sex: male
Acute infarction (localization): antero-septal
Smoker: no
Number of coronary vessels involved: 1
Patient 61:
age: 37
sex: male
Acute infarction (localization): antero-septal
Smoker: yes
Number of coronary vessels involved: 1
Write the MATLAB statement(s) that would you use to,
store, in a variable named caPTB, a one-dimensional
cell array (3 rows x 1 column) that contains three 2-D
(two-dimensional) cell arrays (each 6 rows x 2 columns)
where each 2-D cell array contains, in its first column
the database record labels (eg. age, sex, …) and
in its 2nd column, the corresponding values for each
patient (eg. for patient 59, the values would be: 63,
female, …). Your statement(s) should be such that
the 1-D cell array acts as a database with the record
for patient 59 at index 1, that for patient 60 at
index 2 and that for patient 61 at index 3. Paste
your statement(s) below and then show the result
obtained by typing caPTB{2} in the Command Window.
2. (1) Develop a MATLAB script that uses a for-loop and
calculates the average age of the patients in the
caPTB database of Question 1. Your script should work
with similarly constructed databases that have an
arbitrary number of patients in them (i.e. first, find
the number of patients and store it in a variable,
then compute the sum of patient ages using a for-loop
(patient ages are in row 1 column 2 of each record),
and then compute the average age from the sum and
number of patients). Paste your script and result
in the space below.
3. (1) Repeat Question 1 using a one-dimensional array
(column vector) of structures to implement the
patient database. Store your database in the variable
stPTB. In this database, each record has 6 fields and
field names need to consist of connected alphabetic
characters (no spaces). For example, an appropriate
field name for Acute infarction (localization) would
be: Acute_infarction_localization. Paste your
statement(s) below and then show the result obtained
by typing stPTB(2) in the Command Window.
4. (1) Repeat Question 2 using the database developed
in question 3 (i.e. stPTB). Paste your script and
result (average age) in the space below.
5. (1) Show the MATLAB statements (script) that you would
use to write the contents of the stPTB patient database
of Question 3 to a file named PTBdb.txt using
low-level i/o functions (and a for-loop). Write one data
value per line in the file (i.e. with 3 patients and 6
fields per record, your output file will have 18 lines).
Paste your script in the space below and also paste the
last 12 lines that result from typing: type PTBdb.txt
into the Command Window (after you wrote the data to the
file).
6. (1) Show how you would use MATLAB’s writetable() function
to write the contents of the stPTB array of Question 3
to a file named ‘dbPTBtb.txt’. Paste the statement(s) that
you used for this task in the space below and also paste
the result of typing: type dbPTBtb.txt in the Command
Window (after you’ve written the data to file) in the space
below.
7. (1) Write down the sequence of MATLAB statements
text format, the complete genome for the “Dengue virus 2
isolate DENV-2/US/BID-V5413/2009”, Accession Number:
JF730054.1, GI: 335883038, via the urlread() function,
sequence.
8. (3 points) Modify the ekg_mach_GUI program presented at
the end of lecture L03_08_MATLAB_GUI_PROG (with code
in folder L03_08_09_files) so that it can read and
display 4 simultaneous EKG traces, obtained from file
for patient 60 of the PTB Diagnostic ECG Database. The
file has 16 columns of values, and the rows are spaced
by 1 millisecond (1 ms). The first column is time, in
seconds, columns 2 to 4 are the limb signals i, ii and
iii, respectively, columns 5 to 7 are the augmented
limb signals aVL, aVR and aVF, columns 8 to 13 are
the precordial signals V1 to V6, and columns 14 to 16
are signals Vx, Vy and Vz, respectively. All signals
are in millivolts (mV).
Your updated program will plot the 4 signals: aVL,
aVR, aVF and V1, which are in columns 5 to 8 of the
input data file. The plots will be done on 4 sets
of axes on the GUI.
For this homework question, you will rename (or copy)
the code file ekg_mach_GUI to HW10_ekg, before
starting to update it. (do this now).
To start, you’ll want to update the ekg vector:
ekg = zeros(3000,1);
so that is becomes a matrix with 4 columns (1 column
per signal) instead of a vector with just 1 column
(here, we want to plot 4 signals, not just one).
Then you’ll want to change the code that places an
axis on the GUI:
pltax = axes(‘units’,’pixels’,’Position’,[ 50 80 300 280],’tag’,’axes1′);
p = plot(pltax,tms,ekg);
axis([0 3 -0.25 0.75])
xlabel(‘time (s)’); ylabel(‘AVL (mV)’);
so that it places 4 axes there instead. The 4 axes
should be stored in a cell array for easy referencing
later on. Here is a programmatic skeleton for this:
plbl = {‘aVL’,____,____,____}; % ylabels for plots
ph = 120; pw = 130;
% height and width of “subplots”
p = cell(4,1);
% cell array for plot axes
for ax = _____
pltax = axes(‘units’,’pixels’,…
‘Position’,[ 50+___*(pw+50) 80+___*(ph+50) pw ph],…
‘tag’,[‘axes’ num2str(ax)]);
p{ax} = plot(pltax,tms,ekg(:,ax)); % store axis in cell array
axis([0 3 -2 2])
xlabel(‘time (s)’); ylabel([____ ‘ (mV)’]);
end
In the file reading section of the code, you’ll
want to update the fscanf() statement so that it
reads as many data items as there are columns of
data in the input file (i.e. in ekg001_12leads.txt):
d = fscanf( fid, ‘%g’, _____ );
as a result, d will be a vector (rather than a
scalar as it was previously). You’ll then want
to select appropriate elements (columns) of this
vector, that correspond to aVL, aVR, …, and
store them in the ekg matrix:
ekg(k,:) = d(___:___);
Finally, instead of plotting a single curve, on
the single axis p, with:
set(p,’ydata’,ekg);
you’ll need to loop over the axes in the cell
array p, and set the ‘ydata’ for each axis
in this cell array to the data found in the
corresponding column of the ekg matrix.
You will probably notice substantial baseline
wandering in the plotted ekg, as is commonly
observed in practice. You may remove some of
this artifact by plotting, for each axis
(i.e. for each column of the ekg matrix) the
ekg data minus the mean of ekg data for that
column/signal.
Paste your updated GUI-based ekg display code
file into it and press the DRAW button, wait
for the program to complete, take a screenshot
of your GUI at this time and paste it below your

attachment

Are you having trouble with the above assignment or one similar?

We offers 100% original papers that are written from scratch.We also have a team of editors who check each paper for plagiarism before it is sent to you.
!-- End of Footer -->