plotting two curves together in only one figure for different intervals

1 view (last 30 days)
There are two mathematical functions in below:
y=-0.6729+4.8266x-0.4855x^2+0.0312x^3 from x=0 to x=33.5
y=-486.39+151.64Ln(x) from x=33.5 t0 45
Please help me, how can I plot these together in MATLAB?

Accepted Answer

Friedrich
Friedrich on 13 Feb 2012
Hi,
maybe like this:
y_1 = @(x) -0.6729+4.8266*x-0.4855*x.^2+0.0312*x.^3
y_2 = @(x) -486.39+151.64*log(x)
x_1 = 0:0.1:33.5;
x_2 = 33.5:0.1:45;
plot(x_1,y_1(x_1),'b',x_2,y_2(x_2),'b')

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!