How do I make a summation equation in MATLAB?
1 次查看(过去 30 天)
显示 更早的评论
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1295255/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1295260/image.png)
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 个评论
Walter Roberson
2023-2-14
you should not be convolving the integral with the second equation. You should be convolving the function and the samples from the mat file
回答(1 个)
Sai
2023-2-21
编辑: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:
- 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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Signal Generation and Preprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!