How to plot an equation that uses multiple files of data

1 visualización (últimos 30 días)
Matthew Portnoy
Matthew Portnoy el 24 de Oct. de 2020
Respondida: VBBV el 24 de Oct. de 2020
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);

Respuesta aceptada

VBBV
VBBV el 24 de Oct. de 2020
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)

Más respuestas (0)

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by