How can i draw the graph of this two functions using matlab

1 次查看(过去 30 天)
  1 个评论
Rik
Rik 2020-12-19
You can find guidelines for posting homework on this forum here. If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks).

请先登录,再进行评论。

回答(1 个)

Rafael Hernandez-Walls
when i have this like problem i use this code:
t=linspace(0,2*pi,50);
f=((t>0)&(t<=1)).*2+((t>1)&(t<=pi/2)).*0.5.*t.^2+((t>pi/2)).*cos(t);
plot(t,f)
  2 个评论
Rik
Rik 2020-12-19
Why did you post a complete solution to a homework question?
I would also use ... to make each piece of this function more distinct:
t=linspace(0,2*pi,50);
f= ((t>0)&(t<=1) ).*2+...
((t>1)&(t<=pi/2)).*0.5.*t.^2+...
((t>pi/2) ).*cos(t);
plot(t,f)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by