Advertisement
TwentyEight

(a)

Jan 12th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.13 KB | None | 0 0
  1. % Probability Density Functions are where the probability of a domain on the x-axis occurring is dictated by the area of this function over this domain.
  2. % Search it up if still unsure. Normal distribution bell-curve is an example.
  3. % Area under the whole of probability density function has to 1 exactly.
  4. % Area is found by the definite integral of this function over the entire domain of this function (0 to pi/2)
  5. % Indefinite integral of a*sin(t) is -a*cos(t) + C
  6. % Area between 0 and pi/2 is [-a*cos(t=pi/2)+C] - [-a*cos(t=0)+C] = a = 1
  7. % a = 1;
  8. % What is the probability of a signal lasting between 0 and x? This is the area between 0 and x
  9. % [-a*cos(t=x)+C] - [-a*cos(t=0)+C] = -a * cos(x) + a
  10.  
  11. x = 0 : 0.01 : pi/2;
  12. a = 1; b = 2; c = 1/2;
  13. F = -a * cos(x) + a; FF = -b * cos(x) + b; FFF = -c * cos(x) + c;
  14. plot(x, F, x, FF, x, FFF);
  15. xlabel('x'); ylabel('Probability of signal between 0 and x'); title('Probability of signal between 0 and x for varying a');
  16. legend('a = 1', 'a = 2', 'a = 0.5');
  17.  
  18. % Probability of signal lasting between 0 and pi/2 has to be 1 (always certain) as this is the range of signals.
  19. % We can confirm a = 1 does this.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement