Search code examples
matlabplotfieldtrigonometrygraphic

MATLAB Trigonometry Find Field


I have this trigonometric equation;

cos(2*pi*50*t)+cos(2*pi*100*t)

I want to graphic of equation and I want to find field for a period. How can I do?

enter image description here


Solution

  • Graph:

    >> f = @(t) cos(2*pi*50*t) + cos(2*pi*100*t);
    >> x = linspace(0, 1/50, 100);
    >> y = f(x);
    >> plot(x,y)
    

    Area over 1 period:

    >> integral(f, 0, 1/50)
    

    or just do it manually:

    ∫ ( cos(2π·50t) + cos(2π·100t) ) dt = 
    -1/2π·( 1/50·sin(2π·50t) + 1/100·sin(2π·100t) )
    

    which, evaluated between 0 and 1/50, equals 0.