Error using <= Not enough input arguments

1 次查看(过去 30 天)
This is my matlab code, it shows me error.
%computation of lambda - i curve
clear all
close all
%assign parameters
cm = 1e-2;
mm = 1e-2;
w=1*cm; %core width
Ws=5*cm; %slot width
ds=2*cm; %slot depth
d=5*cm; %depth
g=1*mm; %air gap
N=100; %number of turns
muo=4e-7*pi; %perm of free space
Bsat=1.3; %sat flux density
mur=1500; %init rel permeability
Am=w*d; %mag cross section
%start with flux linkage
lambda= linspace(0,0.08,1000);
%find flux, B, mu
phi=lambda/N;
B=phi/(w*d);
mu= muo *(mur-1)./(exp(10*(B-Bsat)).^2+1)+ muo;
%assign reluctance
Ric=(Ws+w)./(Am*mu);
Rbuc=(Ws+w)./(Am*mu);
Rg=g/(Am*muo);
Rluc= (ds+w/2)./(Am*mu);
%compute effective reluctance
Reff= Ric+Rbuc+2*Rg+2*Rluc;
%compute mmf and current
F=Reff.kphi;;
%find the characteristics
figure(1)
plot(i, lambda);
xlabel ('i,A');
ylabel ('\lambda, Vs');
grid on;
%show B-H characteristics
H=B/mu;
figure (2)
plot (H,B);
xlabel('H')
ylabel('B')
grid on;
Dot indexing is not supported for variables of this type.
I corrected it but still shows me :Dot indexing is not supported for variables of this type.

回答(1 个)

Walter Roberson
Walter Roberson 2021-6-15
Reff= Ric+Rbuc+2*Rg+2*Rluc;
That is a mathematical computation. The result is going to be numeric.
F=Reff.kphi;;
Reff is numeric, not a structure, and not an OOP object. It does not have any field or property named kphi
You do not have any variable named kphi
But perhaps what you intended was
F=Reff.*phi;;
  5 个评论
sara07x x
sara07x x 2021-6-15
编辑:Walter Roberson 2021-6-15
yes it worked with figure 2 but figure 1 is still empty and shows me this Warning: Imaginary parts of complex X and/or Y arguments ignored.
%computation of lambda - i curve
clear all
close all
%assign parameters
cm = 1e-2;
mm = 1e-2;
w=1*cm; %core width
Ws=5*cm; %slot width
ds=2*cm; %slot depth
d=5*cm; %depth
g=1*mm; %air gap
N=100; %number of turns
muo=4e-7*pi; %perm of free space
Bsat=1.3; %sat flux density
mur=1500; %init rel permeability
Am=w*d; %mag cross section
%start with flux linkage
lambda= linspace(0,0.08,1000);
%find flux, B, mu
phi=lambda/N;
B=phi/(w*d);
mu= muo *(mur-1)./(exp(10*(B-Bsat)).^2+1)+ muo;
%assign reluctance
Ric=(Ws+w)./(Am*mu);
Rbuc=(Ws+w)./(Am*mu);
Rg=g/(Am*muo);
Rluc= (ds+w/2)./(Am*mu);
%compute effective reluctance
Reff= Ric+Rbuc+2*Rg+2*Rluc;
%compute mmf and current
F=Reff.*phi;;
%find the characteristics
figure(1)
plot(i, lambda);
xlabel ('i,A');
ylabel ('\lambda, Vs');
grid on;
%show B-H characteristics
H=B./mu;
figure (2)
plot (H,B);
xlabel('H')
ylabel('B')
grid on;
I think there is somthing wrong in plot(i, lambda);
Walter Roberson
Walter Roberson 2021-6-15
plot(i, lambda);
You have not assigned to i anywhere in the code, so i has its default value as a function that returns the scalar sqrt(-1)
lambda= linspace(0,0.08,1000);
lambda is your independent variable. Why are you trying to plot() it in the dependent-variable position of the plot() call?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by