Orbiter-Forum MATLAB Fourier Transform of a Triangle Wave
 User Name Remember Me? Password
 Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

 Notices Due to unforeseen circumstances the scheduled routine maintenance for tonight has been postponed. A new notice will be presented when it is rescheduled.

 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.

 Thread Tools

 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 Project Orbiter Addons     OrbitHangar Addons & Comments     Addons     Addon Development     Addon Requests     Addon Support & Bugs         Addon Developer Forums 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 12:46 AM.

 Quick Links Need Help?

 Contact Us - Orbiter-Forum - Top

About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright ©2007 - 2012, Orbiter-Forum.com. All rights reserved.