Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
% set matrix
Patient_HR = [ 40 45 50 47; 68 66 68 69; 77 75 76 78 ]
% get matrix row and height
[ rows, columns ] = size(Patient_HR)
% create a n-row, single column matrix of zeros
AverageHR = zeros( rows, 1 )
% loop through each row in matrix
for index = 1 : rows
% assign temp to row
temp = Patient_HR(index, :)
% average values in temp row and set in AverageHR matrix
AverageHR(index, 1) = mean(temp)
end
suma = 0;
y=0;
h=0;
x=0.3*pi;
total = 0;
vv=0;
for n = 0:2:60
(n/2)+1
suma = (((-1)^y*(x^n)/(factorial(n))))
total = total + suma
vv = cos(suma)
y=y+1
end
%Ejercicio hecho en clase 10/04/2019
clear, clc, close all
[x, fs] = wavread('C:\Users\student\Downloads\sample.wav'); % get the sound file
x = x(:, 1); % get the first channel
xmax = max(abs(x)); % find the maximum value
x = x/xmax; % scale the signal
% time vector generation
N = length(x);
t = (0:N-1)/fs;
% cepstral analysis
[C, q] = cepstrum(x, fs);
% plot of the signal
figure(1)
subplot(2, 1, 1)
plot(t, x, 'r')
xlim([0 max(t)])
ylim([-1.1*max(abs(x)) 1.1*max(abs(x))])
grid on
set(gca, 'FontName', 'Times New Roman', 'FontSize', 14)
xlabel('Time, s')
ylabel('Normalized amplitude')
title('The signal in the time domain')
% plot of the cepstrum
% 1 ms minimum speech quefrency (1000 Hz) and 20 ms maximum speech quefrency (50 Hz)
subplot(2, 1, 2)
plot(q*1000, C, 'r');
grid on
xlim([1 20])
set(gca, 'FontName', 'Times New Roman', 'FontSize', 14)
xlabel('Quefrency, ms')
ylabel('Amplitude')
title('Amplitude cepstrum of the signal (quefrencies from 1 ms to 20 ms)')
function PowerIter
n=500;
A=randn(n,n);
A=(A+A')/2;
for testtime=1:5
y0=randn(n,1);
y0=y0/norm(y0);
[mu,y]=Power(A,y0);
% Store mu and y
mu1(testtime)=mu;
y1(:,testtime)=y;
end
% Display the results
disp('The computed eigenvalues are shown below. You will see they are almost the same.')
disp(mu1)
disp('The inner products of computed eigenvectors are shown below.');
disp('You will see some are close to 1, and some are close to -1.');
disp('This shows that the computed vectors may be in opposite direction');
disp('but both are the same eigenvector.')
disp(y1'*y1)
% Below is the subroutine of power iteration.
function [mu,y]=Power(A,y0)
maxit=10^4;
epsilon=1e-6;
y=y0;
for iter=1:maxit
%%%%%%%
%Insert your lines for Power Iteration
m^(k)=A*y^(k-1)
y^(k)=m^(k)/abs (m^k)_2
U^(k)=(y^(k))'*A*(y^(k))
%%%%%%%
% Check: if ||Ay^k - mu^k y^k ||_2<= epsilon, then break the
% for loop.
% Complete the following line
if
abs (A*y^k - m*u^k y^k)_2 <= epsilon
break;
end
end
end
end