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

Relative Power using Matlab

  1. Nov 4, 2009 #1
    I have the following code

    dt = 0.01; % Set the time increment to 0.02 second.
    t = (0:1:199)*dt; % Create a time array.
    x1 = 0.5*square(pi*t); % Use MATLAB to create the signal
    % amplitude +/- 0.5 and period 2.
    subplot(2,1,1),plot(t,x1), axis([0,2.1,-0.6,0.6]);
    x2 = zeros(1,length(x1)); % Define an empty column vector for the
    % triangle function.
    % Use a discrete approximation to the integral of the square
    % wave to create the triangular signal.
    x2(1) = -0.25;
    for i = 2:200; x2(i) = x2(i-1) + x1(i)*dt; end
    subplot(2,1,2),plot(t,x2), axis([0,2.1,-0.6,0.6]);

    I need to calculate the sums of the power (by evaluating the fourier coefficients) in harmonics 1 - 3, 1 - 9, and 1 - 29 for signal x1 relative to the total power in the original signal x1.
    Can anyone help me out??
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted

Similar Discussions: Relative Power using Matlab
  1. Thevenin using MATLAB (Replies: 1)