Log graphic and matrix problem

3 views (last 30 days)
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

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 19 Nov 2019
Edited: KALYAN ACHARJYA on 19 Nov 2019
Try with (element wise operation)
.^

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!