'Recorded signal file with .sig extension and plotting the signal
I have a recorded signal file that contains a vector of values containing samples in the form of real and imaginary parts. I need to plot this signal in matlab. Maybe someone faced such a problem.
I can't attach a file, so here is a link to Google Drive
L = 150;
header = struct('DataType','double',...
'Complexity',false,...
'FrameSize',L,...
'NumChannels',1);
writer = dsp.BinaryFileWriter('2665-0.sig',...
'HeaderStructure',header);
sine = dsp.SineWave('SamplesPerFrame',L);
scopewriter = timescope('YLimits',[-1.5 1.5],...
'SampleRate',sine.SampleRate,...
'TimeSpanSource','Property',...
'TimeSpan',1);
for i = 1:1000
data = sine() + 0.01*randn(L,1);
writer(data);
scopewriter(data)
end
Solution 1:[1]
It was a task to get signal analysis data into the Workspace. After this signal can be obtained in Signal Analyzer: https://docs.exponenta.ru/signal/ug/visualize-complex-signals.html
clear all;
close all;
global N_data; %??????????? ?????????????? ????????
N_data = 1048576; %??????????? ?????????????? ????????
i = sqrt(-1);
% ????????? ?????? ??? ???????? ??????? ? ??????????? ???????
op = zeros(1,N_data,'single')+i*zeros(1,N_data,'single');
kontrol = zeros(1,N_data,'single')+i*zeros(1,N_data,'single');
ima_faila = char('file's name');
ima_faila = strcat(ima_faila,'.sig');
signal = fopen(ima_faila,'rb');
if signal == -1
error('net faila');
end
input_s = fread(signal,N_data*4,'int16');
op(1:N_data) = input_s(1:4:N_data*4)+i*input_s(2:4:N_data*4); % ??????? ?????? ?? ?
kontrol(1:N_data) = input_s(3:4:N_data*4)+i*input_s(4:4:N_data*4); % ??????????? ????? ? ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |