Question:

Matlab - Graphing a function

by  |  earlier

0 LIKES UnLike

I need to sketch the following function in matlab. I can do easy ones like 5sin(3t) and have no problem. However i do not know how i enter the following function into matlab to graph it and find the maplitude and period. The function is

......{3.......0<t<4

f(t)={0.......4<t<6

......{f(t 6)

i also then have a second one

......{t.............0<t<2

f(t)={ 3-(t/2).....2<t<6

......{f(t 6)

Any ideas? (also the dots are for formatting they should just be blank space)

 Tags:

   Report

1 ANSWERS


  1. The solution to this problem is some of my own work.

    The basic idea is my functions called  adil&#039;s seed functions;

    adil_box_seed(t)= a* 0.5*  [{ sin(t-x1)/sin{ sqrt( (t-x1)^2)} - { sin( t-x2)/sin{ sqrt( (t-x1)^2) }]

    this function gives you &quot;a&quot; if x1&lt;t&lt;x2 else &quot;zero&quot;

    ...|

    ...|........a _____

    0.|_____|______|______

    ...........x1.......x2

    adil_contineous_seed(t)= a* 0.5*  [1- {sin(x1-t)/sin{ sqrt( (x1-t)^2)}]

    this function gives you &quot;a&quot; if  t&gt;x1 else &quot;zero&quot;

    ...|

    ...|........a _____.._.._.._

    0.|_____|____________

    ...........x1

    So for the following function,

    ......{a.......0&lt;t&lt;x1

    f(t)={b.......x1&lt;t&lt;x2

    ......{f(t x2)

    f(t) =a* 0.5*  [{ sin(t-0)/sin{ sqrt( (t-0)^2)} - { sin( t-x1)/sin{ sqrt( (t-x1)^2) }] +

           b* 0.5*  [{ sin(t-x1)/sin{ sqrt( (t-x1)^2)} - { sin( t-x2)/sin{ sqrt( (t-x1)^2) }]+

    f(t x2)* 0.5*  [1- {sin(x2-t)/sin{ sqrt( (x2-t)^2)}]

    And now your function;

    ______________________________________...

    ......{3.......0&lt;t&lt;4

    f(t)={0.......4&lt;t&lt;6

    ......{f(t 6)

    f(t) =3* 0.5*  [{ sin(t-0)/sin{ sqrt( (t-0)^2)} - { sin( t-4)/sin{ sqrt( (t-4)^2) }] +

         f(t 6)* 0.5*  [1- {sin(6-t)/sin{ sqrt( (6-t)^2)}]

    ______________________________________...

    ......{t.............0&lt;t&lt;2

    f(t)={ 3-(t/2).....2&lt;t&lt;6

    ......{f(t 6)

    f(t) =t* 0.5*  [{ sin(t-0)/sin{ sqrt( (t-0)^2)} - { sin( t-2)/sin{ sqrt( (t-2)^2) }] +

          {3-(t/2)}* 0.5*  [{ sin(t-2)/sin{ sqrt( (t-2)^2)} - { sin( t-6)/sin{ sqrt( (t-6)^2) }] +

         f(t 6)* 0.5*  [1- {sin(6-t)/sin{ sqrt( (6-t)^2)}]

    _____________________________________

    I hope that is what you wanted.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.