MATLAB: Plot two symbolic functions in same figure but different range.

ezplotsymbolic functions

I have two symbolic functions 'u1' and 'u2' which are defined by the same parameter 't'. I need to plot a function u = u1 for t= 0 to 5 and u2 for t = 5 to 20 , I tried the following but the result was that I got u2 from 5 to 20 as an output –
syms t
u1 = sin(t); %the actual functions are complicated
u2 = 5t;
ezplot (u1 , [0 5])
hold on
ezplot (u2, [5 20])
How can I solve my issue?

Best Answer

xlim([0 20])