MATLAB Answers

Programming a bit pattern to the function generator

1 ビュー (過去 30 日間)
Dilesh Mutta
Dilesh Mutta 2019 年 7 月 3 日
回答済み: Maadhav Akula 2019 年 7 月 29 日
I am trying to generate a random bit pattern of 60bits at 86kHz to generate it on a function generator. Could anyone guide please? I am justt looking to create an excel file of my wave.

  0 件のコメント

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

回答 (1 件)

Maadhav Akula
Maadhav Akula 2019 年 7 月 29 日
I understand that you want to generate a random 60-bit pattern at a frequency of 86kHz, the following code gets you the required pattern for 1 second :-
clear all; %Clears the workspace
f = 86000; %Defining Frequency = 86khz
t0 = 1; %Defining t0 = 1 second
t = 0:1/f:t0; %Defining a time vector for t0 seconds of frequency 86kHz
N = length(t); %Length of the time vector
random_bits = randi([0,1], N,60); %Required random bit pattern
you can change t0 values according to your requirements.
You can export the variables from workspace in many ways, you can directly copy the data by opening variable editor and paste it in your excel sheet or you can refer to the link below on how to export it programmatically : -
Hope it helps!

  0 件のコメント

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

Community Treasure Hunt

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

Start Hunting!

Translated by