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

8 visualizzazioni (ultimi 30 giorni)
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 Commento
Jakub Panuska
Jakub Panuska il 24 Feb 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

Accedi per commentare.

Risposte (1)

MHN
MHN il 24 Feb 2016
Modificato: MHN il 25 Feb 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.

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by