How do I make a summation equation in MATLAB?
2 views (last 30 days)
Show older comments
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
Please help.
2 Comments
Walter Roberson
on 14 Feb 2023
you should not be convolving the integral with the second equation. You should be convolving the function and the samples from the mat file
Answers (1)
Sai
on 21 Feb 2023
Edited: Sai
on 21 Feb 2023
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:
- Artifact – free: ‘clean’ - x
- Noise: ‘noisy’ - y
- Impulse response: ‘h’ - ‘h’
- 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’.
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
0 Comments
See Also
Categories
Find more on Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!