Answer to Question #249096 in MatLAB for ddd

Question #249096

The heart beat rate has to be well regulated to provide enough oxygenated blood

throughout the body and so depends on feedback with the body’s oxygen demand. A simple discrete model of heart beat regulation is given by:


xt+1 = kxt(1 - xt)


Here xt represents the normalised heart beat rate at time t recorded once per minute. That is, the normalisation involves dividing the actual hear rate in beats per minute by 80 beats per minute.


The parameter k is a positive real number (hopefully) greater than 0.


a) Write a MATLAB program using array operations to generate a table (with headings) of the normalised heart beat rate per minute starting at time t = 0 with the value of x0 entered by the user. Run your program with the maximum time set to 30 minutes. Show table and MATLAB code for x0 = 0.1 and k = 2.


My answer:

x=0.1;

beats= A(1,30); 

for k=1:30

A=2x*(1-x);

x=A;

disp(A)

end


(I am getting an error code and I don't know how to solve it please help me!)


1
Expert's answer
2021-10-09T15:50:52-0400

bitrates.m file:

% bitrates.m
function x = bitrates(k, x0, t_max)
    x = zeros(size(1, t_max+1));
    x(1) = x0;
    for i=1:t_max
        x(i+1) = k * x(i) * (1 - x(i));
    end
end


task.m (or whatever you want, It may be even in a Command Window) file:

% task.m
x0 = 0.1;
k = 2;
t_max = 30;

x = bitrates(k, x0, t_max);
fprintf('time bitrate\n');
for t=0:t_max
    fprintf(' %3d %f\n', t, x(t+1));
end


Results:

>> task
time bitrate
   0 0.100000
   1 0.180000
   2 0.295200
   3 0.416114
   4 0.485926
   5 0.499604
   6 0.500000
   7 0.500000
   8 0.500000
   9 0.500000
  10 0.500000
  11 0.500000
  12 0.500000
  13 0.500000
  14 0.500000
  15 0.500000
  16 0.500000
  17 0.500000
  18 0.500000
  19 0.500000
  20 0.500000
  21 0.500000
  22 0.500000
  23 0.500000
  24 0.500000
  25 0.500000
  26 0.500000
  27 0.500000
  28 0.500000
  29 0.500000
  30 0.500000

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS