how can i sample this code

조회 수: 2 (최근 30일)
ahmad ramadan
ahmad ramadan 2018년 11월 2일
댓글: Uma sri Vidyadhari 2020년 8월 5일
how can i sample this code at fs=10000
my code
n = 0:35; a = 1.2; K =0.0017;
x = K*a.^n;
stem(n,x);
xlabel('Time index n');ylabel('Amplitude');
  댓글 수: 2
Rik
Rik 2018년 11월 2일
Have a read here (or here for more general advice) and here. It will greatly improve your chances of getting an answer.
Dimitris Kalogiros
Dimitris Kalogiros 2018년 11월 2일
I assume you want to create an exponential signal and sample it at fs=10KHz. What is the analytical (mathematical) formula of your signal? Is it x(t)=K*(a^t) ?

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

답변 (1개)

Dimitris Kalogiros
Dimitris Kalogiros 2018년 11월 2일
clear all; clc; close all;
a = 1.2; K =0.0017;
Fs = 10E3; % sampling frequency 10KHz
Ts = 1/Fs; % sampling period
tsamples = Ts*(0:35); % sampling instants
x = K*a.^tsamples;
%plot versus sample number
figure;
stem(x);
xlabel('index n');ylabel('Amplitude');
%plot versus time
figure;
stem(tsamples, x);
xlabel('time (sec)'); ylabel('Amplitude');
  댓글 수: 2
Rik
Rik 2018년 11월 2일
You should avoid clear all, especially outside of debugging. It is better to use clearvars.
Uma sri Vidyadhari
Uma sri Vidyadhari 2020년 8월 5일
May be just use
clear
instead of
clear all

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by