How to plot phase graph from csv with real and imaginary values?
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
Jakub Panuska
2016-2-24
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
回答(1 个)
MHN
2016-2-24
编辑:MHN
2016-2-25
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!