sample time and simulink system period

本文介绍了Simulink中信号源的两种配置方式:基于时间(time-based)和基于采样(sample-based)。重点讲解了time-based配置的具体步骤,并讨论了在SystemGenerator中时钟设置的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Simulink中,信号源的产生有两种方式,一种是time-based,另一种是 sample based。


以time-based为例,打开sine wave模块的设置页面,在sine type中选择 Time based。


Sample time中输入采样时间ts。


在使用system generator配置时,注意在clocking选项下面,FPGA clock period 和 simulink system period的选择。


个人倾向于把siimulink system period设置为ts。

当然也可以设置成1。这样的话,前面的那些信号源,最好就用sample based了。

### OOK Modulation Implementation in Simulink In Simulink, implementing On-Off Keying (OOK) modulation involves several key components and blocks that facilitate the process of modulating binary data onto a carrier signal. The procedure includes generating a binary sequence, converting this into an appropriate amplitude level to represent 'on' and 'off', multiplying with a sinusoidal carrier wave when needed, and finally transmitting through an Additive White Gaussian Noise (AWGN) channel or any other medium as required for simulation purposes. To begin creating an OOK model within MATLAB's Simulink environment: 1. Binary Source Generation: Utilize Random Integer Generator block from Communications Toolbox which can produce random integers between specified range; setting it up appropriately will yield bits suitable for transmission[^1]. 2. Amplitude Mapping: A simple method is using MATLAB Function Block where custom code converts input bit stream `0`s and `1`s directly corresponding to absence (`0`) or presence (`A`, non-zero value representing power) of transmitted energy during each symbol period[^2]. 3. Carrier Wave Multiplication: For coherent detection schemes, one might multiply output by sine/cosine waves generated via Sine Wave source configured at desired frequency f_c. This step may be skipped depending on whether baseband equivalent models suffice for analysis objectives[^3]. 4. Channel Effects Simulation: Incorporate AWGN Channel block available under Communication Sources library section simulates real-world imperfections affecting wireless transmissions including noise addition over air interface path loss effects etc.[^4] Below demonstrates how these elements come together forming basic yet functional OOK communication system inside graphical programming tool provided by MathWorks product family members like so, ```matlab % Define parameters such as sampling rate Fs, carrier freq fc, message length Nbits here... Fs = 8e3; fc = 500; Nbits = 10; modelname='ookMod'; new_system(modelname); open_system(modelname); add_block('comm/Random Integer Generator','ookMod/RandIntGen'); set_param(gcb,'MOutputWordLength','1',... 'InitialSeed','79',... 'SampleTime','1/Fs',... 'SamplesPerFrame',num2str(Nbits)); add_block('simulink/User-Defined Functions/MATLAB Function',... 'ookMod/AmpMapFcn'); % Insert necessary lines configuring above added function block... add_block('simulink/Sources/Sine Wave','ookMod/CarrWaveSrc'); set_param(gcb,... 'Amplitude','sqrt(2)',... % Adjust based upon SNR considerations. 'Frequency',num2str(fc),... 'PhaseOffset','0',... 'SampleMode','Discrete',... 'SamplesPerPeriod','Fs/fc',... 'SampleBasedOrSampleTime','-1',... 'InterpretVectorParametersAsMuxes','off'); add_block('communications/Channels/AWGN Channel',... 'ookMod/AddNoiseChnl'); % Connect all previously instantiated subsystems/components accordingly now... save_system(modelname); close_system(modelname,false); disp(['Created ',modelname]); ``` This script automates construction tasks while allowing customization according to specific requirements regarding parameter values used throughout design stages involved in building out full-fledged simulations capable enough for educational demonstrations alongside research prototyping efforts alike.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值