How to define mesh limit on surface plots
4 次查看(过去 30 天)
显示 更早的评论
Hello,
I am plotting a z=@(x,y) type function using syms x y on a surface with fsurf(z) and I get something like this:

How can I get to show the cut region like below (i.e cutting following the mesh/grid rather than the plane)?

Many thanks
2 个评论
采纳的回答
Walter Roberson
2021-8-31
You can change the MeshDensity option; https://www.mathworks.com/help/matlab/ref/fsurf.html#namevaluepairarguments
But what you should probably do instead is
zfun = matlabFunction(zm, 'vars', [k, y] )
now create a meshgrid() of k and y values, and evaluate zfun() at them, and then you can surf() the results, with no adaptive mesh happening.
3 个评论
Walter Roberson
2021-8-31
syms k y;
Dmi = k;
L = y;
TRV = 406458.76;
%% Motor Requirements
Trwheel = 3090.625; % torque at rear wheels
Nwheel = 2152.820; % max wheel speed
wwheel = 225.443; % max wheel speed
GR = 9.5; % gear ratio (9.5 or 7.56)
Vdc = 1000; % [V] max pattery DC voltage
Pout = 250000; % [W] max power out of Battery
Tmotor = Trwheel/GR; % [Nm] motor torque required
Nsmax = Nwheel*GR; % [rpm] max synchonous speed
wmax = wwheel*GR; % [rad/s] max synchonous speed
Nctp = (60/(2*pi))*Pout/Trwheel; % [rpm] Wheel Speed at which Power and Torque are Max (transition from constant T to contsant P region)
Nsbase = Nctp*GR; % [rpm] base speed
wbase = ((2*pi)/60)*Nsbase; % [rpm] base speed
opT = 60; % [°C] operating temperature
Nph = 3; % number of phases
%% Material Properties
% Wire (Copper)
T0 = 20; % [°C] reference temperature
rhoCu0 = 1.7241e-8; % [Ωm] Copper resistivity
alpha = 0.004; % thermal resisitvity coefficient
rhoCures = rhoCu0*(1+(alpha*(opT-T0))); % [Ωm] Copper resistivity at operating T
Dstra = 3e-4; % [m] diameter of each conductor strand
rhoC = 8933; % [kg/m^3] Copper density
% Lamination (VX48, 49% Co-Fe)
Bs = 2.350; % [T] saturation flux density
tauL = 1e-4; % [m] lamination thickness
rhores = 4.2e-7; % [Ωm] lamination resistivity
sigmaL = 1/rhores; % [S/m] lamination conductivity
rhoL = 8120; % [kg/m^3] lamination density
PFE = 1.5; % [W/kg] lamination loss density @50Hz, 1.5T
Stckf = 0.97; % stacking factor [Chau, 2015 p85]
% Magnets (N55, Nd-Fe-B)
Br = 1.49; % [T] remeance magnetic flux density
rhoM = 7450; % [kg/m^3] magnet density
%% Motor Architecture [INTPUT]
% Sizing Parameters
p = 8; % poles
Nsl = 24; % slots
gcs = 0.5e-3; % [m] gap between carbon sleeve and stator (Zhao, 2019)
% Sd = 48.47e-3; % [m] slot depth
Nc = 15; % turns per coil
SFF = 0.6; % slot fill factor (MSO 0.9 CHin, 2021)
JCu = 30e6; % [A/m^2] RMS max current density (Chu, 2020)
pf = 1; % percentage gap between poles
% Carbon Sleeve
tcs = 0.002; %LOOP? % [m] carbon sleeve thickness (Golonov, 2018)
lg = tcs + gcs; % [m] air gap length between stator and rotor
YScs = 800e6; % [N/m^2] yield strength of carbon fibre
SF = 1.4; % safety factor
rhoCS = 1750; % [kg/m^3] carbon sleeve density (Blisset, 2019, p145)
%% Motor Evaluation [COMPUTATION]
% General Sizing
pp = p/2; % pole pairs
lm = 5*lg; % [m] magnet thickness
f = (pp*Nsbase)/60; % [Hz] line voltage frequency
% General Dimensions
Dmo = Dmi+(2*lm); % [m] magnets outer diameter
Dsb = Dmi+(2*lm)+(2*lg); % [m] stator bore diameter
Drom = Dsb-(2*gcs); % [m] rotor outer diameter w/ carbon sleeve
Rmemag = ((Dmo/2)+(Dmi/2))/2; % [m] mean radius of one magnet
% Air Gap Flux
% Bg = Br*lm/(lm+lg); % [T] air gap magnetic flux density
Bg = (Br*(2*Rmemag/Dsb))-((0.12/100)*(opT-T0)*(Br*(2*Rmemag/Dsb))); % [T] air gap magnetic flux density [Hanselman, 2006]
Am = (pi*Dsb*L)/(p/pf); %CHECK L % [m^2] single pole area at stator bore
phitot = Bg*2*pi*(Dmo/2)*L; % [Tm^2] total flux across aigrap [Hanselman, 2006]
% Stator (Tooth, Yoke, Slot Width & Outer Diameter)
% phim = Am*Bg; % [Tm^2] flux per pole per unit length
phit = phitot/Nsl; % [Tm^2] flux per tooth
tw = (pi*Dmo*Bg)/(Nsl*Stckf*Bs); % [m] tooth width
tpitch = (pi*Dsb)/Nsl; % [m] stator tooth pitch
Sw = tpitch-tw; % [m] slot width (0.45 ~ 0.62)*tpitch [Chau, 2015 p63]
% Sw = tpitch*0.535;
Sd = 4.5*Sw; % [m] slot depth (3.5 ~ 5.5)*bss [Chau, 2015 p63]
lsy = (pi*(Dmo/2)*Bg)/(p*Stckf*Bs); % [m] stator & rotor yoke thickness [Hanselman, 2006]
% lsy2 = (Bg/Br)*(pi*Drom)/(4*p); %CHECK Hendershot
Ds = Dsb+Sd; % [m] Davg in middle of slot
Swa = ((pi*Ds)/Nsl)-tw; % [m] average width of the slot (trapezoidal)
Dso = Dsb+(lsy*2)+(Sd*2); % [m] stator outer diameter
Yr = (lsy)/(lsy+Sd); % yoke ratio
%Current
As = Swa*Sd; % [m^2] slot C-S area
ACu = SFF*As; % [m^2] copper C-S area per slot
Irms = ACu*JCu; % [A] RMS current in each slot
% Conductor Current
slp = Nsl/(p*Nph); % slots per pole per phase
Z = 2*Nc; % total number of conductors per slot
i = Irms/Z; % [A] peak line current
iph = i/sqrt(Nph); % [A] peak phase current
% Wire Area
Acon = ACu/Z; % [m^2] conductor C-S area per slot
Dcon = sqrt((4*Acon)/pi); % [m] conductor diameter
Astra = pi*((Dstra/2)^2); % [m^2] area of each strand
Nstra = Acon/Astra; % number of strands
% MLT
roew = (pi*Ds)/Nsl; % [m] outer radii of end winding [Shen, 2012]
riew = tw; % [m] inner radii of end winding [Shen, 2012]
rew = (roew+riew)/2; % [m] average radii of end winding [Shen, 2012]
le = pi*rew; % [m] average length of end winding [Shen, 2012]
MLT = (2*L)+(2*le)+(4*Swa); % [m] mean length of one turn (for Distributed)
% Resistance
Ncoil = Nc*2; % number of coils (2 coils in series per phase)
Ntph = Ncoil*p; % total no. of turns in series per phase
lc = Ntph*MLT; % [m] total length of wire per phase
% Mass Evaluation
Vst = tw*Sd*L*Nsl; % [m^3] stator tooth volume
Vsy = (pi*((Dso^2)-((Dso-(2*lsy))^2))*L)/4; % [m^3] stator yoke volume
Ms = rhoL*(Vsy+Vst); % [kg] stator lamination mass
Vc = (pi*((Dmi^2)-((Dmi-(2*lsy))^2))*L)/4; % [m^3] rotor volume
Mc = rhoL*Vc; % [kg] rotor lamination mass
Vmag = ((pi*L*((Dmo^2)-(Dmi^2)))/4); % [m^3] magnets volume
Mmag = rhoM*Vmag; % [kg] magnets mass
Vw = pi*(Dstra/2)^2*lc*Nph; % [m^3] wire volume
Mw = rhoC*Vw; % [kg] wire mass
MM = Ms+Mc+Mmag+Mw; % [kg] motor mass
% Rotor Inertia
Jr = (Mc+Mmag)*((Dmo/2)^2); % [kg.m^2] rotor inertia at the wheels
MMJ = MM + Jr/((Dmo/2)^2); % [kg] equivalent mass from inertia
laps = 0.4; % [s/kg] average laptime sensitivity
%% Mass Plot
zm = MM;
zmf = matlabFunction(simplify(zm), 'vars', [k, y]);
nk = 11; ny = 20;
[K, Y] = meshgrid(linspace(0.02, 0.1, nk), linspace(0.02, 0.4, ny));
Z = zmf(K, Y);
whos Z
Z(Z < 20 | Z > 60) = nan;
figure;
surf(K, Y, Z);
set(gcf,'position',[10 1350 560 420]);
%xlim([0.02 0.1]);
%ylim([0.02 0.4]);
%zlim([20 100]);
ax = gca;
ax.XAxis.Exponent = -3;
ax.YAxis.Exponent = -3;
xlabel('Stator Diameter (m)');
ylabel('Active Length (m)');
zlabel('Motor Mass (kg)');
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 802.11ad 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



