MATLAB Answers

Z must be a matrix, not a scalar or vector

5 views (last 30 days)
Nico Lastin
Nico Lastin on 22 Apr 2018
Answered: Benjamin Großmann on 22 May 2018
Dear all,
how can I fix the problem that Z must be a matrix?
if true
Nt2 = [1:1:50]; %Turns per Layer driver coil
Na2 = [1:1:50]; %Layers driver coil
N2 = Nt2.*Na2;
fun2 = @(x2_1) (pi.*Di2.*R)./(sigma+epsilon_r.*R.*(1-cos(x2_1)));
q2 = integral(fun2,0,(pi./4));
Cb2 = epsilon_r.*epsilon_0.*q2;
fun2_2 = @(x2_2) (pi.*Di2.*R)./(sigma+epsilon_r.*R.*(1-cos(x2_2))+0.5.*epsilon_r.*h);
q2_2 = integral(fun2_2,0,(pi./4));
Cm2 = epsilon_r.*epsilon_0.*q2_2;
S2_1=0;
i2 = 1:Nt2;
S2_1 = sum((2.*(i2)-1).^2.*(Na2-1));
Cp2 = (1./(N2.^2)).*(Cb2.*(Nt2-1).*Na2 + Cm2.*S2_1)
%%Self-Inductance
b2 = Na2.*ky;
Length2 = Nt2.*OD; %coil thickness
r2_1 = 26.01.*10.^(-3); %radius inside coil
r2_2= r2_1+b2; %radius outside coil
L2_1 = (31.6.*r2_1.^2.*N2.^2)./(6.*r2_1+9.*Length2+10.*(r2_2-r2_1)); %[uH]
L2 = L2_1.*10.^(-6)
%%Self-Frequency
fself2 = 1./(2.*pi.*sqrt(L2.*Cp2))
%%Resistance
RDC2 = Na2.*p.*Nt2.*pi.*Di2./A
RAC2 = RDC2.*FR
%%Quality Factor
Leff2 = L2./(1-omega.^2.*L2.*Cp2).^2;
ESR2 = RAC2./(1-omega.^2.*L2.*Cp2).^2;
Q2 = (omega.*Leff2)./(ESR2)
[Na2,Nt2] = meshgrid(1:0.5:50,1:50);
Z = Q2;
surf(Na2,Nt2,Z) code
end

  0 Comments

Sign in to comment.

Answers (1)

Benjamin Großmann
Benjamin Großmann on 22 May 2018
You calculate Z (or Q2) using variables that you do not provide us. so it is not possible to give an adequate answer. Is Q2 a matrix, vector or scalar? What do you expect that "surf" does if Z is not a matrix?
The inputs of surf have to be matrices of same size. Each element of these matrices is belongs to one data point (xi,yi,zi) which is plotted in a 3D-coordinate system. Furthermore, color is used to represent the value of zi. You can also provide a fourth argument C to specify color.

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags


Translated by