MATLAB: Log graphic and matrix problem

loggraphMATLAB

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

Best Answer

Try with (element wise operation)
.^
Related Question