MATLAB Answers

Need the function or Equation that solve this kind of questions?

15 views (last 30 days)
Dodo
Dodo on 24 Oct 2020 at 19:58
Commented: Star Strider on 25 Oct 2020 at 11:00

  1 Comment

madhan ravi
madhan ravi on 24 Oct 2020 at 20:16
madhan ravi:
What did you try?
Dodo:
Thanks alot for your reply. I searched and found that piece wise equation can solve it but but prof needs to be plotted the graph by the logical indeing method and don't know how to apply it and so on. becuse Piesce wise made a wrong plotting. Thanks in advance,

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 24 Oct 2020 at 20:37
This is not your function, however it illustrates the ‘logical indexing’ approach:
f = @(x) (2-2*x).*(x <= 0) + (2+2*x).*(x>0);
t = linspace(-3, 3);
figure
plot(t, f(t))
grid
ylim([0 max(ylim)])
It is not difficult to figure out how it works. Be inspired by it!

  3 Comments

Dodo
Dodo on 25 Oct 2020 at 6:46
Thank you alot. please I need the question of this answer in order to understand.
Star Strider
Star Strider on 25 Oct 2020 at 11:00
Walter — Thank you!
Dodo — We provide hints for homework assignments, not actual code. If you post the code you have written and are having problems with it, we will help you get it to run. We will not write it for you!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!