Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A Make a function

Tags:
  1. Nov 26, 2016 #1
    function.png How do I make a function that can draw this same graph ? Also, if i want to increase the frequency of the function, how do i do that ?
    so I am thinking f(x) = sin(x) for -1<= f(x) =0.5; f(x) = e^(x)/10 for f(x)= <=1 ; f(x) = cos(x) for f(x) >=0.5
    f(x) = -cos(x)
    um... i do not think this is right.
    help
     
  2. jcsd
  3. Nov 26, 2016 #2

    Krylov

    User Avatar
    Science Advisor
    Education Advisor

    Is this the graph of something you measured? Or is it the graph of something you simulated?

    In either case, given a graph on a certain interval (say, a time interval) it is in general not possible to define a function in terms of elementary functions (such as polynomials, harmonics, exponentials, etc.) that replicates said graph, even when you allow for piecewise definition.

    In a sense, the graph itself is the definition of the function you are looking for.
     
  4. Nov 26, 2016 #3
    hi, so that is graph of an 12 Hole Ocarina playing the note e.
    wait I cant make a function out of it ?
     
  5. Nov 26, 2016 #4

    Krylov

    User Avatar
    Science Advisor
    Education Advisor

    Nice. From your graph you can see that there is a harmonic in the background (probably its frequency corresponds to your "e"), but there is something else on top of it that reflects the fact that you are close to producing an "e", but you do not manage to do that with mathematical perfection.

    Probably a spectral decomposition would show a peak at the "e" frequency, but in addition there will be some much smaller mini-peaks around it.
     
  6. Nov 26, 2016 #5

    Nidum

    User Avatar
    Science Advisor
    Gold Member

    If you just want to draw the graph and manipulate it in a visual sense then use ordinate samples and a spline routine . Some spread sheets can do this but it is not difficult to write a program .
     
  7. Nov 26, 2016 #6

    Nidum

    User Avatar
    Science Advisor
    Gold Member

    A method commonly used in engineering computation is to break down the curve of interest into a sequence of segments where each segment can be defined with a simple function .
     
  8. Nov 26, 2016 #7

    Krylov

    User Avatar
    Science Advisor
    Education Advisor

    I think that is what the OP was trying to do.

    Because it appears this is the recording of a real musical instrument playing an "e", to me it would provide most insight to Fourier decompose the recording, keep as many modes as one likes and use these to reconstruct an approximation to the original signal.

    The OP could do both: direct approximation using piecewise definition (using e.g. splines, as Nidum suggested) and a spectral approximation, and compare.
     
  9. Nov 26, 2016 #8
    Function2.png
     
  10. Nov 26, 2016 #9
    I was trying to do the
    sorry,
    I am not understanding what you are saying here...
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Make a function
Loading...