How to add zero points in a function

조회 수: 2 (최근 30일)
Yian Chen
Yian Chen 2021년 10월 23일
댓글: Image Analyst 2021년 10월 24일
Right now I have a function h = sin(2*pi*50*t) with 27 samples, and I want to add 500 zeros to the end of the 27-signal-long signal. How can I mke it?
fs = 250;
t = (0:1/fs:(0.108-.5/fs)); % [0, 0.108)
h = sin(2*pi*50*t);
L = 27;
f = fs*(0:L-1)/L;

채택된 답변

Image Analyst
Image Analyst 2021년 10월 23일
If h is your signal, assign the last element to be zero
h(527) = 0;
The in between values will be automatically filled with zeros.
  댓글 수: 2
Yian Chen
Yian Chen 2021년 10월 23일
Thanks for your answer, but in this case how can I modify my code to make it?
Image Analyst
Image Analyst 2021년 10월 24일
clc
clear all
close all
fs = 250;
t = (0:1/fs:(0.108-.5/fs)); % [0, 0.108)
h = sin(2*pi*50*t);
L = 27;
f = fs*(0:L-1)/L;
h(527) = 0;

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Fourier and Cosine Transforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by