cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Plot function

ptc-6891538
1-Visitor

Plot function

We want to define a function that gives the values

f (a) = 2a when a is between 0 and 5

f (a) = 10 when a is between 5 and 10

f (a) = 0 all other times

and then plot the function with that range −5 < a < 15

I have tried it but my plot just don't seem right look at the attachment. can you show me how to do it in MATHCAD

2 REPLIES 2
Werner_E
25-Diamond I
(To:ptc-6891538)

I have tried it but my plot just don't seem right look

Why? Your plot is showing exactly what you want with just one exception - there is nothing plotted in the range from-5 to 0, because your function is not providing values for a<0. This can be repaired if you replace the last if-statement by an otherwise-statement.

For further questions please note that its adviseable to attach your worksheet, not just a screenshot.

RichardJ
19-Tanzanite
(To:ptc-6891538)

What you have is correct (or almost correct, anyway). What makes you think it's wrong?

The graph would look better if you changed the y axis limits a little. If you click on the plot you will see placeholders at the top and bottom of the axis. Try typing in -1 and 11 for the limits.

Also, your function is technically not quite correct. The second line says that if a=10 then the result should be 10, but the third line says if a=10 then the result should be 0. The statements should not overlap. Also, replace the last one with "otherwise", which also covers the case when a<0.

graph.png

Announcements

Top Tags