Plotting Multiple Equations on One Graph in MATLAB?

chief10
Messages
78
Reaction score
0

Homework Statement



Does anyone know how to do this? Let's say I had the equation:

f(t) =
|2t, 0≤ t < 2
|(t^2)-3, 2≤t

how would you plot this over 0≤ t ≤4 in Matlab?


Homework Equations



-

The Attempt at a Solution



I've tried ezplot but i can't manage getting both equations on the same graph

Thanks guys and girls.

-chief10
 
Physics news on Phys.org
worked it out!

if anyone is interested the code is belowsyms x y
ezplot(function, [xmin,xmax])
hold on
ezplot(function2, [xmin,xmax])
hold off
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top