How to plot an equation that uses multiple files of data

2 次查看(过去 30 天)
I am trying to plot the equation Zc over frequency.
There are 5 text files that are given in this code, for right now I am just using 3, freq1, Rzero1, and Lzero.
The problem is when I go to plot(freq1,Zc). I get a Error using plot Vectors must be the same length.
Attached is the 3 text files and below is the code and what the graph is supposed to look like.
clear all;
clc;
load freq1.txt;
load Rzero1.txt;
load Lzero1.txt;
load Rpos1.txt;
load Lpos1.txt;
Czero = 7.524/1e3;
Cpos = 1.2027/1e3;
Gzero = 2/1e8;
Gpos = 2/1e8;
w(1)=0;
Zc(1)=0;
i=1;
k=1;
n=10;
for i=1:(size(Rzero1,1)-1)/n
w(i) = 2*pi*freq1(k);
Zc(i) = sqrt(((Rzero1(k+n/2)+1j*w*Lzero1(k+n/2))/(Gzero+1j*w*Czero)));
k=k+n;
end
plot(freq1,Zc);

采纳的回答

VBBV
VBBV 2020-10-24
I see the graph with log scale on x axis
See the code
clear all;
clc;
load freq1.txt;
load Rzero1.txt;
load Lzero1.txt;
%load Rpos1.txt;
%load Lpos1.txt;
Czero = 7.524/1e3;
Cpos = 1.2027/1e3;
Gzero = 2/1e8;
Gpos = 2/1e8;
w(1)=0;
Zc(1)=0;
i=1;
k=1;
n=10;
for i=1:size(Rzero1,1)
w(i) = 2*pi*freq1(i);
Zc(i) = sqrt(((Rzero1(i)+1j*w*Lzero1(i))/(Gzero+1j*w*Czero)));
% k=k+n;
end
semilogx(freq1,Zc);
figure(2)
plot(freq1,Zc)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Entering Commands 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by