Hi I need help with this This is a EGC MATLAB PROGRAM with f
Hi! I need help with this:
This is a EGC MATLAB PROGRAM, with functions! I have a problem, I dont know how to put in my program the graphs in the picture.
This is my program and the functions below: (I need the above graph urgent) Thanks a lot if you can help me!
Instructions:
%PROGRAM:
clc, close all, clear all
direccion=input(\'pegue la direccion del archivo a cargar: \',\'s\');
addpath(direccion)
data=input(\'nombre del archivo: \',\'s\');
expdata=load(data);
if size(expdata)== size(zeros(length(expdata(:,1)),1))
Fs=input(\'entre la frecuencia de muestreo [Hz] : \');
dt=1/Fs;
y=expdata(:,1);
x = 0:dt:(length(y)-1)*dt;
elseif size(expdata)==size(zeros(1,length(expdata(1,:))))
Fs=input(\'entre la frecuencia de muestreo [Hz] : \');
dt=1/Fs;
y=expdata(1,:);
x = 0:dt:(length(y)-1)*dt;
else
x=expdata(:,1);
y=expdata(:,2);
end
[vabs,pico]=picosmax3(x,y);
[intx,int]=distanciaa(vabs);
[frec,prom,dstd,outr]=FcPromStdOutb(int);
figure;
subplot(321);plot(x,y,\'-k\'); %grafica(1)
xlabel(\'tiempo [s]\'); ylabel(\'voltaje [mV]\');
subplot(322);plot(x,y,\'-k\'); %grafica(2)
xlim([868,888]); xlabel(\'tiempo [s]\'); ylabel(\'voltaje [mV]\');
subplot(323);plot(x,y,\'-k\');hold on
plot(vabs, pico,\'or\', \'MarkerSize\',8,\'MarkerEdgeColor\',\'r\', \'MarkerFaceColor\',\'g\'); xlim([868 888])
hold on %grafica(3)
xlabel(\'tiempo [s]\'); ylabel(\'voltaje [mV]\');
subplot(324); plot(intx,int,\'-k\'); %grafica(4)
xlabel(\'tiempo [s]\'); ylabel(\'R-R interval[s]\');
subplot(325);plot(intx,int,\'-k\');
hold on;
plot(prom,\'-b\');hold on;
plot(prom+3*dstd,prom-3*dstd,\'-r\');hold on
plot(dstd,\'og\');ylim([0 120]);hold on;
hold on
%Function#1:
function [vabs,pico]=picosmax(x,y) %THIS FUNCTION IS TO FIND THE MAX AND MIN IN DATA
lx=length(x);
v=0;
for kx=737:lx-1;
if y(kx)>y(kx-1) && y(kx)>y(kx+1)
v=v+1;
vabs(v)=x(kx);
pico(v)=y(kx);
maxvabs(v)=max(y);
end
end
%FUNCTION2:
function [frec,prom,dstd,outr]=FcPromStdOutb(int)
li=length(int);
m=0;
for j=1:li
fq=int(j)*60; %60seg=1min
frec(j)=fq;
end
lf=length(frec);
prom=sum(frec)/lf;
dstd=((sum((frec-prom).^2))/(lf-1))^0.5;
for f=1:lf;
if frec(f)>(prom+3*dstd) || frec(f)<(prom-3*dstd)
m=m+1;
pout=frec(f);
outr(m)=pout;
end
end
end
Solution
Please include the below piece of code to add an image into your matlab codes:
srcFiles = dir(\'D:\\Matlab Images\\*.jpeg\'); % Provide the folder path in which ur image is existing
for i = 1 : length(srcFiles)
filename = strcat(\'D:\\Matlab Images\\\',srcFiles(i).name);
I = imread(filename);
figure, imshow(I);
end

