Orbiter-Forum MATLAB Fourier Transform of a Triangle Wave
 Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

 Math & Physics Mathematical and physical problems of space flight and astronomy.

 11-24-2010, 01:50 PM #1 n72.75 Donator MATLAB Fourier Transform of a Triangle Wave So I've been banging my head against a little MATLAB problem for the past four hours or so. I'm trying to compute the Fourier series of a triangle wave (for the purpose of none other then my own enjoyment). For some reason I can't seem to get the code right: Code: ```clear; clc; format long; itteration_count = 50; sum_count = 50; peroid = 2*pi; origin = 0; t = origin:peroid/itteration_count:peroid; f = 1:itteration_count+1; for k = 0:itteration_count sum = 0; for n = 1:2:sum_count sum = sum + (((((-1)^((n-1)/2))/n^2)*sin((n*pi*t(k+1)))/peroid)); end f(k+1) = sum*(8/(pi^2)); end plot(t,f)``` EDIT: Never mind, I just set the iteration count higher and it works. Last edited by n72.75; 11-24-2010 at 05:35 PM.

 Posting Rules BB code is On Smilies are On [IMG] code is On HTML code is Off You may not post new threads You may not post replies You may not post attachments You may not edit your posts
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Orbiter-Forum.com     Announcements     Meets & Greets Orbiter Space Flight Simulator     Orbiter Web Forum         OFMM         Orbiter Forum Space Station         Simpit Forum     General Questions & Help     MFD Questions & Help     Hardware & Software Help     Tutorials & Challenges     Orbiter SDK     Orbiter Visualization Project     Orbiter Beta » Orbiter Project Orbiter Addons     OrbitHangar Addons & Comments     Addons     Addon Development     Addon Requests     Addon Support & Bugs         Addon Developer Forums     Orbiter Lua Scripting Far Side of the Moon     Spaceflight News     Math & Physics     Astronomy & the Night Sky     Backyard Rocketry     Brighton Lounge     International Forum

All times are GMT. The time now is 07:35 PM.