How to match the matrix dimension ?

1 vue (au cours des 30 derniers jours)
manish kumar
manish kumar le 19 Fév 2019
Réponse apportée : KSSV le 19 Fév 2019
clc
clear all
close all
load ('C:\Users\manish\Downloads\100ml.mat')
val=val';
plot(val)
I=val((1:end),1);
str1=dec2bin(typecast(int8(I),'uint8'));
ecg_signal_I=filtering(I);
c1=dec2bin(typecast(int8(ecg_signal_I),'uint8'));
figure
title('I')
plot(ecg_signal_I)
ylim([-1000 1000])
sampling_frequency = 360;
mains_coeff = 0.1; % Amplitude of mains line to change. Depends on your ECG signal.
time_step = 1/sampling_frequency;
max_time = 2; % Duration of your signal in seconds.
t = time_step:time_step:max_time; % This is our time vector.
mains_signal = cos(2*pi*110*t); % 110Hz mains frequency. Depends.
dirty_signal = val' + mains_coeff*mains_signal;
plot(dirty_signal);
I am getting error in second last line of the above code: Matrix dimensions must agree.
Error in c100ml2 (line 21)
dirty_signal = val' + mains_coeff*mains_signal;
  2 commentaires
James Tursa
James Tursa le 19 Fév 2019
What are the dimensions of the variables that cause the error?
manish kumar
manish kumar le 19 Fév 2019
"Val" are of 3600*1 double and "Main_signal" are of 1*720 .

Connectez-vous pour commenter.

Réponses (1)

KSSV
KSSV le 19 Fév 2019
Val" are of 3600*1 double and "Main_signal" are of 1*720
How do you expect them to add? YOu need to do interpolation and get them to the same dimensions. Read about interp1

Community Treasure Hunt

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

Start Hunting!

Translated by