Log graphic and matrix problem

2 次查看(过去 30 天)
hi, i got issue with my code, i want to display function on graph with semilogx but i got "matrix error":
Error using ^ (line 51)
Incorrect dimensions for raising a matrix to a
power. Check that the matrix is square and the
power is a scalar. To perform elementwise matrix
powers, use '.^'.
Error in Grzesik_cz3/plot_g (line 13)
y=20*log(abs((1/(R1*R2*C1*C2))/(((1j*2*pi*x)^2)+((1j*2*pi*x)*((1/(R1*C1))+(1/(R2*C1))+(1/(R2*C2))))+(1/(R1*R2*C1*C2)))));
Error in Grzesik_cz3 (line 9)
plot_g(C1,R1,C2,R2)
thisis my code:
function Grzesik_cz3
%deklaracje
C1=0.000000032;%F%
C2=0.000000032;%F%
R1=1000;%Ohm%
R2=1000;%Ohm%
plot_g(C1,R1,C2,R2)
function plot_g(C1,R1,C2,R2)
x=0.001:1000000;
y=20*log(abs((1/(R1*R2*C1*C2))/(((1j*2*pi*x)^2)+((1j*2*pi*x)*((1/(R1*C1))+(1/(R2*C1))+(1/(R2*C2))))+(1/(R1*R2*C1*C2)))));
figure
semilogx(x,y);
hold off
end
end

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019-11-19
编辑:KALYAN ACHARJYA 2019-11-19
Try with (element wise operation)
.^

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by