# How do I make a summation equation in MATLAB?

2 ビュー (過去 30 日間)
Brooke 2023 年 2 月 14 日

The equation I'm trying to get is the response equation but for the life of me I cannot figure out what I'm supposed to do to type it out. Here is my code:
t = time;%time for both
T = noisy;%frequency of the first signal
Ts = clean;%frequency of the second signal
h = h;%sampling interval
N = length(clean);%length of impulse response
x = integral(h(T)*x(t-T),T,-inf,inf);%first signal
y = ;%second signal
convolution = conv(x,y) %convolution of both the signals x & y
figure;%making the plots
subplot(2,2,1);%plot for the noisy spike train
plot(t,noisy);
title('Time vs. Noisy Spike train');
xlabel('time');
ylabel('spike train');
yline(y,r,resting);
yline(y,g,threshold);
yline(y,b,peak membrane potential);
subplot(2,2,2);%plot for the clean spike train
plot(t,clean);
title('Time vs. Clean Spike train');
xlabel('time');
ylabel('spike train');
yline(y,r,resting);
yline(y,g,threshold);
yline(y,b,peak membrane potential);
subplot(2,2,3);%plot for the clean spike train
plot(t,clean);
title("Time vs. Conv'd Spike train");
xlabel('time');
ylabel("conv'd spike train");
And here is the question i'm trying to answer:  I must just not be ansking the right questions when serching for how to write out that y(nTs) equation because I've only ended up confusing myself further on what to do. (Also I think I have everything needed to make the plots cprrectly
##### 2 件のコメント表示 1 件の古いコメント非表示 1 件の古いコメント
Brooke 2023 年 2 月 14 日
Oh ok, So now that I've tried that I'm getting an error for:
"Array indices must be positive integers or logical values.
Error in MATLAB_project1_real (line 6)
x = integral(h(T)*x(t-T),T,-inf,inf);%first signal"
and I don't know what to do here...

サインインしてコメントする。

### 回答 (1 件)

Sai 2023 年 2 月 21 日

Hi,
I understand that you are unable to use summation equation in MATLAB and need some assistance in applying convolution to the signals.
From my understanding, the corresponding file ‘apfilter.mat’ contains four columns/vectors.
They are:
1. Artifact – free: ‘clean’ - x
2. Noise: ‘noisy’ - y
3. Impulse response: ‘h’ - ‘h’
4. Time: ‘time’ - time’
Many questions that only need plotting the signals or vectors are rather simple. It can be done using plot command.
plot(clean,time)
plot(noisy,time)
The convolution must be applied between either ‘clean’ or ‘noisy’ with impulse response ‘h’.
Please refer to the conv documentation for doing convolution.
Now again the resultant vectors are plotted using plot.
plot(conv(clean,h),time).
All the labelling can be followed as in your code.
There is no need of using summation.
For future reference, please refer to the summation documentation for using summation – discrete integral.
Regards,
G. Saikumar,
MathWorks Technical Support

サインインしてコメントする。

### カテゴリ

Find more on Electrophysiology in Help Center and File Exchange

R2022b

### Community Treasure Hunt

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

Start Hunting!