Question:
MATLAB HELP!!!! HOW TO PLOT PIECEWISE FUNCTION AND FOURIER SERIES?
2012-09-08 00:35:24 UTC
The Fourier Series is a series representation of a peridoic function in terms of sines and cosines. The Fourier series representation of the function

f(x)={1 0 {-1 -pi
is (4/pi)(sin(x)/1+sin(3x)/3+ sin(5x)/5)+sin(7x)/7+...)

plot on the same graph the function f(x) and its series representation using the four terms shown.

MY QUESTION IS.. how the hell do i plot the piecewise, can someone just explain how to do this because my MATLAB professor is a complete dumbass and doesnt even teach ****. So I have to learn everything on me own!
Three answers:
Rs_reddy
2012-09-08 03:05:47 UTC
Question is not clear. From my understanding, you need to plot outcomes of two functions for same data range with a specified interval in same plot with common X& Y axis. one is the square wave and onother one is "g(x)=(4/pi)(sin(x)/1+sin(3x)/3+ sin(5x)/5)+sin(7x)/7"



you can do this by discreatizing continues functions with some interval



generate datasets (x1,y1) for "f(x)={1 0


method 1:

plot(x1,y1,s1,x2,y2,s2,x3,y3,s3,...)



method 2:

plot first graph then use "hold on" after that plot another graph you will get two plots on same graph.



for any more information you can use matlab help.
Kailash
2014-08-13 01:48:37 UTC
The function f(t) is 3 –periodic and f(t)={t,0≤t≤1, 1,1
2012-09-08 13:58:04 UTC
Here are some examples on piecewise functions with Matlab:

(just remove the blank after the /, and follow the link)



matrixlab-examples.com/ piecewise-function.html

matrixlab-examples.com/ scilab-piecewise-function.html





About Fourier series:



matrixlab-examples.com/ fourier-analysis.html

matrixlab-examples.com/ fourier-series.html


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...