Obtain the phase difference between the two columns of signals based on the waveform data stored in the oscilloscope (MATLAB source code)

Publisher:gamma14Latest update time:2022-10-17 Source: csdnKeywords:Oscilloscope Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Purpose

The waveform displayed by the oscilloscope is as follows, and the phase difference between the two columns of signals needs to be obtained through MATLAB processing.

Insert image description here

step

Insert the USB flash drive into the oscilloscope and store the signal sequence. Read this .CSV signal sequence file in MATLAB and process it to obtain the phase difference. code show as below:


clear all

close all

%Read data

t=xlsread('A2.CSV','A2','A1:A500');%Read time series

x=xlsread('A2.CSV','A2','B1:B500');%Read reference signal

x1=xlsread('A2.CSV','A2','C1:C500');%Read the signal to be measured

subplot 211;

plot(t,x,'b-');hold on;

plot(t,x1,'r--');grid;

legend('Reference','Signal');title('Origin');


%Data normalization

m1=(max(x)+min(x))/2;

m2=(max(x1)+min(x1))/2;

x=(x-m1)/max(x);   

x1=(x1-m2)/max(x1);

subplot 212;

index=find(x==0);

plot(t,x,'b-');hold on;

plot(t,x1,'k--');grid;

hold on;

legend('Reference','Signal');title('Normalization');


num=500; %number of data

l=0:1:num;

x=x;

y=x1;

Ix=sum(x.^2)/num;

Iy=sum(y.^2)/num;

Ixy=sum(x.*y)/num;

c=180*acos(Ixy/(Ix*Iy)^0.5)/pi; %Calculate phase difference

%disp(['Phase difference is',num2str(c), 'degree']);

output = sprintf('Phase difference is %f degrees', c);

output


result

Insert image description here

Keywords:Oscilloscope Reference address:Obtain the phase difference between the two columns of signals based on the waveform data stored in the oscilloscope (MATLAB source code)

Previous article:Experiment - measuring phase difference with oscilloscope method (test record)
Next article:Oscilloscope calibration and Lissajous figure

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号