error: Function definition is misplaced or improperly nested in matlab guide, pls help! (error in line function edit17_callback...)
Afficher commentaires plus anciens
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Dt L bg br Z Kc Bsicma Udmpha d1 d2 h kld J ni gama cosphi
%DUONG KINH TRONG LOI THEP STATOR Dt
Dt = get(handles.edit1, 'string');
Dt = str2double(Dt);
L = get(handles.edit2, 'string');
L = str2double(L);
bg = get(handles.edit3, 'string');
bg = str2double(bg);
br = get(handles.edit4, 'string');
br = str2double(br);
Z = get(handles.edit5, 'string');
Z = str2double(Z);
Kc = get(handles.edit6, 'string');
Kc = str2double(Kc);
Bsicma = get(handles.edit7, 'string');
Bsicma = str2double(Bsicma);
Udmpha = get(handles.edit8, 'string');
Udmpha = str2double(Udmpha);
d1 = get(handles.edit9, 'string');
d1 = str2double(d1);
d2 = get(handles.edit10, 'string');
d2 = str2double(d2);
h = get(handles.edit11, 'string');
h = str2double(h);
kld = get(handles.edit12, 'string');
kld = str2double(kld);
J = get(handles.edit13, 'string');
J = str2double(J);
ni = get(handles.edit14, 'string');
ni = str2double(ni);
gama = get(handles.edit15, 'string');
gama = str2double(gama);
cosphi = get(handles.edit16, 'string');
cosphi = str2double(cosphi);
%GAN CHUOI
%TINH TOAN(DANG 6 DAU RA)
%DAU SAO
Udsao = sqrt(3)*Udmpha;
%DAU TAM GIAC
Uddelta = Udmpha;
Npha1 = (Dt-L)/Pdm;
Nb1 = Npha1/2;
%BUOC 2 XAC DINH SO CUC
Pmin_1 = (0.4*Dt)/bg;
if 2 <= Pmin <5
sodoicuctu = 4;
else 1< Pmin<3
sodoicuctu = 2;
end
%BUOC 3
%Buoc cuc (anfasixma = 0.71)
To = (pi*Dt)/(Pmin*1000);
%DIEN TICH MAT CUC TU
Scuctu = To*L;
%TU THONG
phi = 0.71*to*L*Bsicma;
%BUOC 4 (knc = 0.94)(MAT DO TU THONG QUA GONG LOI THEP)
Bg = (0.71*pi*Dt*Bsicma)/(Z*br);
%BUOC 5 (MAT DO TU THONG QUA RANG STATOR
Br = (pi*DT*Bsicma)/(Z*br);
%BUOC 7 TINH HE SO DAY QUAN
kdq = (sin(q*(anphad/2))/(q*sin(anphad/2)));
%HE SO DANG SONG TU TRUONG TRONG KHE HO KHONG KHI CUA DONG CO
Ks = 1.07;
%BUOC 8 TONG SO VONG CUA MOI PHA DAY QUAN
if 15<= Scuctu < 50
kE = 0.805;
else if 50<= Scuctu < 100
kE = 0.88;
else if 100<= Scuctu <150
kE = 0.915;
else if 150<= Scuctu < 400
kE = 0.94;
else if 400<= Scuctu
kE = 0.96;
end
Npha = (kE*Udmpha)/(4*Ks*f*phi*kdq);
%SO BOI DAY
soboiday = sodoicuctu*3;
%SO VONG MOI BOI DAY TRONG PHA Nb
Nb = Npha/soboiday;
%XAC DINH TIET DIEN RANH (RANH QUA LE)
Sr = ((d1+d2)/2)*(h-(d2/2))+(pi*d2^2/8);
%TIET DIEN 1 SOI DAY KE CA CACH DIEN
%DO Z/p LA SO CHAN NEN TA QUAN 1 LOP => n=1
Scd = (kld*Sr)/(1*Nb);
%DUONG KINH 1 DAY DAN KE CA LOP VO BOC
dcd = 1.128*sqrt(Scd);
%DUONG KINH DAY TRAN KHONG LOP MAN BOC
d = dcd -0.05;
%TINH DONG DIEN DINH MUC
Idmpha = (pi*d^2/4)*J;
%BUOC 11 TINH CONG SUAT DINH MUC
Pdm = 3*Udmpha*Idmpha*ni*cosphi;
%BUOC 12 XAC DINH KHOI LUONG DAY QUAN
%BE DAI DAU NOI TINH GIUA 2 RANH LIEN TIEP
Kl = (pi*gama*(Dt+h))/Z;
%BUOC NOI DAY
y = Z/(3*sodoicuctu);
%TINH LPHAY
Lphay = L + 0.07;
%CHU VI KHUON CV
CV8 = 2*(Kl*y+Lphay);
CV7 = 2*(Kl*y+l);
%TONG CHIEU DAI CUA MOI PHA DAY QUAN
Lpha = CV*Nb*(Z/(3*sodoicuctu));
L3pha = Lpha*3;
%KHOI LUONG DAY QUAN CHO BO DAY 3 PHA
Wday = (1.2*9.8*L3pha*pi*d*d*0.0001)/4;
%XUAT KET QUA
set(handles.edit17,'string',num2str(Npha));
set(handles.edit18,'string',num2str(Nb));
set(handles.edit19,'string',num2str(d));
set(handles.edit20,'string',num2str(dcd));
set(handles.edit21,'string',num2str(CV7));
set(handles.edit22,'string',num2str(CV8));
set(handles.edit23,'string',num2str(Wday));
set(handles.edit24,'string',num2str(Pdm));
function edit17_Callback(hObject, eventdata, handles)
% hObject handle to edit17 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit17 as text
% str2double(get(hObject,'String')) returns contents of edit17 as a double
Réponses (0)
Catégories
En savoir plus sur Atomic, Molecular & Optical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!