Adding a pulse every 0.5 seconds
Show older comments
Hi,
I'm trying to add a pulse every 0.5 seconds (0.5 seconds separation between pulses), but I'm not sure where I'm going wrong.
Here's my code so far:
t0 = 0; % initial time
tf = 4; % final time
dx = (1/1349.9); % step size
time = [t0:dx:tf]; % time array for excitation
n = int16((tf-t0)/dx); % number of samples
du = 0.5; % separation length in seconds
num_pulses = 10; % number of pulses
u = zeros(n); % empty array for neural excitation value
u_1 = excitation_value('153us'); % neural excitation value from dictionary for a given pulse width
for p = 1:num_pulses
for i = 1:n
u = u + u_1(i*du);
end
end
3 Comments
Nomit Jangid
on 22 Sep 2020
What is the pulse width? Do you have user-defined functions/custom function "excitation_value" ?
Ashlynn Gallagher
on 24 Sep 2020
VBBV
on 25 Nov 2020
u_1 = 153e-06; % excitation_value('153us'); is 153 microseconds
for p = 1:num_pulses
for i = 1:n
u(i) = u(i) + u_1*du;
end
end
Answers (1)
Nomit Jangid
on 22 Sep 2020
0 votes
There are few things i'd like to suggest
- "zeros(n)" functions returns an n-by-n matrix of zeros.(not array)
- MATLAB does not have any inbuilt function "excitation_value"
- Assuming pulse is generating in every 0.5 sec, there should be 2*60*60 pulses every hour.
Categories
Find more on MATLAB 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!