# MATLAB - Fourier (how do I do this)

• MATLAB

## Main Question or Discussion Point

I would like to use Matlab to check my answers.

For example, I want to find the Fourier transform of $$\cos \omega_0 t$$.

$$\pi ( \delta(\omega - \omega_0) + \delta(\omega + \omega_0))$$.

How do I do this in Matlab. All I can find is something like this:
Code:
clc;
syms t;
fourier(cos(t))
This returns:
Code:
pi*(dirac(w-1)+dirac(w+1))
I would really like to be able to do something like:
Code:
clc;
syms t;
fourier(cos(a*t))
and get:
Code:
pi*(dirac(w-a)+dirac(w+a))
so I can actually check harder transforms.

How would I do this?

Related MATLAB, Maple, Mathematica, LaTeX News on Phys.org
Just make sure that "a" is also initialized in your symbolic variables.

>> syms a t
>> fourier(cos(t))

ans =

pi*(dirac(w - 1) + dirac(w + 1))

>> fourier(cos(a*t))

ans =

pi*(dirac(a + w) + dirac(a - w))
{"ft_lang_label":"__label__en","ft_lang_prob":0.7700517,"math_prob":0.94214636,"size":937,"snap":"2020-10-2020-16","text_gpt3_token_len":287,"char_repetition_ratio":0.116827436,"word_repetition_ratio":0.56626505,"special_character_ratio":0.33191034,"punctuation_ratio":0.14215687,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9999666,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-03-30T07:47:49Z\",\"WARC-Record-ID\":\"<urn:uuid:1efa63d5-1ec2-477b-bbef-191843c2a97b>\",\"Content-Length\":\"76187\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:af835f4b-9a66-4430-91da-5b8f756b62cd>\",\"WARC-Concurrent-To\":\"<urn:uuid:4ffdcb75-852b-41d0-8166-1371e78cdcd9>\",\"WARC-IP-Address\":\"23.111.143.85\",\"WARC-Target-URI\":\"https://www.physicsforums.com/threads/matlab-fourier-how-do-i-do-this.162532/\",\"WARC-Payload-Digest\":\"sha1:L4CL6ME7XE3AEIURTKFKUBXOIWH53N3V\",\"WARC-Block-Digest\":\"sha1:AC7S3JJGH3UXKLIQ5MDH7XEXRRHM3DP6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-16/CC-MAIN-2020-16_segments_1585370496669.0_warc_CC-MAIN-20200330054217-20200330084217-00014.warc.gz\"}"}