How Do You Convert a Time Domain Waveform to Frequency Domain in MATLAB?

In summary: This should fix the error and allow you to plot your graph. In summary, the speaker is new to MATLAB and is having trouble converting a wave form from time to frequency domain. They have attempted to use integration by parts and have provided MATLAB files. They also have questions about generating odd values for a specific equation and plotting a graph between amplitude and time. The expert suggests using a for loop to generate odd values and correcting the syntax in the code to plot the graph successfully.
  • #1
cobraa_eyz
3
0

Homework Statement



Dear all ,

Am new to matalb and am having some couple of problems. i want to convert the following wave form from time to frequency domain .

1.E=ACos(ωt+φ).[0,T]
I have made conversion by using integration by parts.Please find the MATLAB attached files.

ACos(ωt+φ)*exp(-jωt) , limit [0,T]

2. For T=n*pi/2ω where n= odd, how to generate odd values of "n".

3. Graph
When ever i try to plot a graph between Amplitude and Time , it generates error or when ever i plot a graph between two variable values e.g
T 1:45;
Pi 0:360;
"? Error using ==> mtimes
Inner matrix dimensions must agree."

Homework Equations



The Attempt at a Solution


T=n*pi/2w where w= omega
function L=laser()
%T=n*pi/2w where w= omega
w=2*pi*1.93*10^14;
phi= 0:360;
T=45;% just used to plot a graph

L= (-cos(phi)*w*sin(w*T)*exp(-j*w*T))+(w*cos(phi))-sin(phi)*(w*cos(w*T)*exp(-j*w*T)-w+ (w^2)*sin(w*T)*exp(-j*w*T)/(1+w^2))
subplot(1,1,1), plot(phi,L);
end

Thanks
 
Physics news on Phys.org
  • #2
in advance For question 2, the odd values of n can be generated by using a for loop. For example: w = 2*pi*1.93*10^14; n = 1; for n = 1:2:500 T = n*pi/2*w; end This will generate odd values for n from 1 to 500. For question 3, it looks like there is a problem with the syntax in your code. Try changing the lines T 1:45;Pi 0:360;to T = 1:45;phi = 0:360;
 
  • #3
for your question. Frequency domain conversion is a common technique used in signal processing to analyze signals in the frequency domain rather than the time domain. This can be useful for identifying specific frequencies present in a signal and for filtering out unwanted frequencies.

In your case, it seems like you are trying to convert a waveform from the time domain to the frequency domain using MATLAB. Your approach of using integration by parts is a valid method for this conversion. However, it looks like you may have some errors in your code. Without seeing the MATLAB files you have attached, it is difficult for me to pinpoint the exact issue. I would suggest checking your code for any typos or syntax errors.

For your second question about generating odd values of "n" for T=n*pi/2ω, you can use a for loop or a vector to generate the values. For example, if you want to generate the first 10 odd values of "n", you could use the following code:

n = 1:2:19; % generates odd values from 1 to 19

Finally, for your third question about plotting a graph between amplitude and time, the error message you are receiving suggests that there is an issue with the dimensions of your variables. Make sure that the dimensions of your variables are compatible for multiplication. If you are still having trouble, try using the "plot" function with two separate vectors for the amplitude and time values, rather than using a function to define the values.

I hope this helps. Best of luck with your MATLAB homework!
 

Related to How Do You Convert a Time Domain Waveform to Frequency Domain in MATLAB?

What is frequency domain conversion?

Frequency domain conversion is the process of transforming a signal from the time domain to the frequency domain. This allows for the analysis and manipulation of signals in terms of their frequency components rather than their amplitude over time.

Why is frequency domain conversion important in scientific research?

Frequency domain conversion is important in scientific research because it allows for a deeper understanding of signals and their underlying characteristics. It also enables researchers to identify and isolate specific frequency components, which can provide valuable insights and aid in the development of new technologies.

What techniques are commonly used for frequency domain conversion?

Some common techniques for frequency domain conversion include Fourier transforms, wavelet transforms, and z-transforms. Each of these techniques has its own advantages and can be used depending on the specific needs of the researcher or application.

How does frequency domain conversion differ from time domain conversion?

Frequency domain conversion differs from time domain conversion in that it focuses on the frequency components of a signal rather than its amplitude over time. Time domain conversion, on the other hand, looks at the changes in amplitude over a given period.

What are some practical applications of frequency domain conversion?

Frequency domain conversion has many practical applications, including signal processing, image processing, audio and video compression, and data analysis. It is also used in various fields such as telecommunications, medical imaging, and geophysics.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
779
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
3K
  • Electrical Engineering
Replies
17
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
Back
Top