필터 지우기
필터 지우기

A very basic question about plotting a signal in the time domain

조회 수: 7 (최근 30일)
Im trying to plot a sound file by the following code, but I get this error each time:_* Vectors must be the same lengths*_. What should I do in order to make it done?
%%Load the signal into MATLAB
[signal,Fs,nbits,opts] = wavread('stry.wav');
%%Plot the signal
tSampling=1/Fs;
t=-0.005:tSampling:0.005;
plot(t,signal);
I plot the signal by this command: plot(signal) but I need the x axis to be the time, and not the samples.
I hope someone can help me!
Negar

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 16일
편집: Azzi Abdelmalek 2013년 9월 16일
tSampling=1/Fs;
n=numel(signal);
t=-0.005:tSampling:-0.005+(n-1)*tSampling;
plot(t,signal);
%or
t=linspace(-0.005,0.005,numel(signal));
plot(t,signal)
  댓글 수: 1
Negar
Negar 2013년 9월 17일
편집: Negar 2013년 9월 17일
Thanks a lot ! It was really helpful ! :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by