How to generate a costant signal?

3 ビュー (過去 30 日間)
Edoardo Demattei
Edoardo Demattei 2021 年 1 月 13 日
コメント済み: Edoardo Demattei 2021 年 1 月 14 日
I have some difficulties on this code. I want to generate a 10 V constant signal, which function should I use? In this short passage I generate a sinusoidal signal, thanks for support
N= 500; %number of samples
Np= 3; %number of periods
%% Sampling
n=(0:N-1)'; %indices of samples
Fx= Np/N; %digital frequency
wt= 2*pi*Fx*n; %argument of periodic functions
%% Sinusoidal signal, mean 0
Vmax=10; %max value
x_sin = Vmax*sin(wt);
figure(1)
plot(n*Fx,x_sin)

採用された回答

Jon
Jon 2021 年 1 月 13 日
Here's an example that you can add to the bottom of your code
%% Constant signal
sigVal=3; % example value
x_const = sigVal*ones(N,1)
figure(2)
plot(n*Fx,x_sin,n*Fx,x_const)
  1 件のコメント
Edoardo Demattei
Edoardo Demattei 2021 年 1 月 14 日
Thank you for the support

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by