I'm new to matlab and i need to write a code for my homework problem and i need help from u guys. Thank u.
So basically I have P equal to different function with variable t when t is in different range.
P = 10*t/t1 when t<t1
= 10 when t1<= t <2*t1
= -10*t/t1+30 when 2*t1<= t <3*t1
= 0 when 3*t1<= t
Note: t1 will act as a constant and give a vector of P(t) with every different value of t1.
For example when t1=5, it will give a vector of P(t); and when t1=10, it will give another vector of P(t).
Then I want to use P to compute U and Udot values.
Please help me out.
t = [0:0.005:15.01];
j = 1:1000;
t1= [0.005:0.005:5]; %varying t1
P = ...
(Po*t/t1(i) ) .* (t < t1(i) ) + ...
(Po ) .* (t1(i) <= t & t < 2*t1(i) ) + ...
(-Po*t/t1(i) + 30 ) .* (2*t1(i)<= t & t < 3*t1(i)) + ...
(0 ) .* (3*t1(i) >= 15 );
%IV.Computing U and Udot values:
Thanks a lot.