How to plot phase graph from csv with real and imaginary values?

15 visualizaciones (últimos 30 días)
Alan Liu
Alan Liu el 24 de Feb. de 2016
Editada: MHN el 25 de Feb. de 2016
Hi I was wondering if anyone could help with me plotting data from a csv file. I have 3 columns, the first being frequency from 1ghz-2ghz, the second column being real S11, and the third being imaginary S11. I obtained the data from a network analyzer and would like to get that graph that I saw from the network analyzer and put that into matlab. I first imported that data into matlab then set each column to a variable so:
x=freq;
y=real;
z=imag;
plot(x,[y,z])
Any help would be great thanks!
  1 comentario
Jakub Panuska
Jakub Panuska el 24 de Feb. de 2016
you can use csvread to read your data into matlab...be aware about your delimiter in csv
data=csvread('myFile.dat') %you should use full path to your directory or set the directory in matlab current folder window
freq=data(:,1); %read data in column (specify your column) 1 into freq
real=data(:,2); %read data in column (specify your column) 2 into real
imag=data(:,3); %read data in column (specify your column) 3 into imag
phase=atan(imag/real); %phase angle

Iniciar sesión para comentar.

Respuestas (1)

MHN
MHN el 24 de Feb. de 2016
Editada: MHN el 25 de Feb. de 2016
It depends on what would you like to plot. But first you must define them as complex number for Matlab:
z = complex(real, imag);
Now you can plot them based on what you want to plot. for example plot the real part based on frequency, plot the imaginary part based on frequency, plot the absolute value based on frequency, the phase based on frequency, and so on.

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by