How do I import complex numbers into MATLAB when I only have amplitude and phase data in seperate columns?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ben Cheshire
le 17 Fév 2022
Commenté : Mathieu NOE
le 18 Fév 2022
The attached file shows a list of complex numbers against freqency (it is FRF H1 data for an active noise cancellation setup) formatted with frequency in the first column, amplitude in the second, and phase in the third (
). Due to the software I'm using to generate the data, there isn't a way of downloading the data in the cartesian format, so I need to make do with having 3 columns instead of just 2.

Is there a way of importing this into MATLAB as a complex double matrix .m file?
Thanks in advance
0 commentaires
Réponse acceptée
Mathieu NOE
le 17 Fév 2022
hello
see below
clc
clearvars
M = csvread('PP-R3 - FRF H1.csv',19);
freq = M(:,1);
data_complex = M(:,2) + 1i*M(:,3);
mod_db = 20*log10(abs(data_complex));
phas = 180/pi*(angle(data_complex));
figure
subplot(211),plot(freq,mod_db);
subplot(212),plot(freq,phas);
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Signal Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!