Hi i need to draw
figure(3);
ezplot(@(x) sqrt(x),[0;4]),
axis equal
this graphic it the mirror to axis x=4 and in interval [4;8] as well to draw an axel x=4.

5 个评论

That is likely not possible with ezplot or fplot. You need to use plot.
Maybe you can help me to do it with plot, I will be very grateful
What have you tried so far??? Not really sure what you want, precisely...
I must draw first sqrt(x) in the interval [0;4] then draw this function mirror-wise the x=4 in the interval[4;8]
There are probably a few different ways to do this. If you have to do it mirror-wise, think about how to set up your ‘x’ vector to do that.
I already coded it successfully. (It looks like a Gothic arch.)

请先登录,再进行评论。

 采纳的回答

We do not give complete solutions to homework problems here.
I present an approach to an analogous problem to give you a hint as to one possible way to solve yours:
f = @(x) (abs(x)-5).^3;
xv = [-10:0.5:0 0.5:0.5:10];
xp = 1:numel(xv);
figure(1)
plot(xp, f(xv))
grid
I have deliberately not explained how it works. I leave that for you to discover.
EDIT — (14 Mar 2018 at 01:51 UCT)
To complete this, my solution for this problem is:
f = @(x) sqrt(x);
t = linspace(0, 8, 200);
figure(3)
plot(t((t >= 0) & (t < 4)), f(t((t >= 0) & (t < 4))))
hold on
plot(t((t >= 4) & (t <= 8)), f(fliplr(t((t >= 0) & (t < 4)))))
plot([4 4], ylim, '--g')
hold off
axis equal

1 个评论

Or, one of the many alternatives -- likewise for OP to understand how it works so can explain his solution to instructor...given above f, but
t=linspace(0,4,100);
then
plot(t,f(t)), hold on, plot(t+4,f(-t+4))
Or, another closely related to the above but slightly different--
y=[f(t) f(-t+4)];
plot(linspace(0,8,length(y)),y)

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by