function out=quad_migration(paths) M=(5:.025:65)';rho0=1.225;g=9.81;Tb=288.15;Lb=-.0065; rho=rho0*(Tb/(Tb+Lb*150))^(1+g*.029/(8.314*Lb));R=.533;Om=150;A=pi*R^2; labels={'He_original_n6','only_n6_to_n4','explicit_H2_mass','add_buffer_1p07kg','add_payload_1kg','shaft_bus_boundary_once'}; n=[6 4 4 4 4 4];closed=[false false true true true true];buffer=[0 0 0 1.07 1.07 1.07];payload=[0 0 0 0 1 1]; results=zeros(numel(M),numel(n));powers=results;summary=struct([]); for k=1:numel(n) W=M*g;P=1.12*W.*sqrt(W/(2*rho*n(k)*A))+n(k)*.008*.1*rho*A*(Om*R)^3/8; boundary='original eta_FC*eta_prop*eta_motor*eta_controller';eta=.5*.8*.95*.95; if k==6,P=P/(.95*.95);eta=.5;boundary='shaft dividedmotor/ESConce;P_FC=bus;eta_propremovedexplicitlytoavoidduplicateaeroloss';end PD=1000*(.52-.46*exp(-P/700));PD(P>=2500)=520;mf=P./PD;budget=.5*M-buffer(k)-payload(k)-mf; alpha=1.67*1000/(120e6/3600);beta=-.44*1000/(120e6/3600); if closed(k),me=(budget-beta)/(1+alpha);else,me=budget;end H=alpha*me+beta;T=H*(120e6/3600)*eta./P;T(me<=.26|H<=0|P>5500)=NaN; results(:,k)=T;powers(:,k)=P;[tv,im]=max(T,[],'omitnan'); s=struct('step',labels{k},'rotors',n(k),'R_m',R,'Omega_rad_s',Om,'altitude_m',150,'rho_kg_m3',rho, ... 'includes_H2_in_total_mass',closed(k),'buffer_kg',buffer(k),'payload_kg',payload(k),'efficiency_boundary',boundary, ... 'max_paper_domain_h',tv,'mass_at_max_kg',M(im),'scope','original He coefficient functions retained; paper5-65kgdomain,notfullhardwarefeasibility'); if isempty(summary),summary=s;else,summary(end+1)=s;end end writetable(array2table([M results],'VariableNames',[{'mass_kg'},labels]),fullfile(paths.run,'quad-migration-endurance.csv')); writetable(struct2table(summary),fullfile(paths.run,'quad-migration-step-summary.csv'),'Encoding','UTF-8'); out=struct('source_route','He Eqs1-5,8-15 andTable2','steps',summary,'current_catalogue_geometry_step','see upper-bound-summary andactualBOMstaticmapseparately'); r23.write_json(fullfile(paths.report,'quad-migration-summary.json'),out); fig=figure('Position',[100 100 1100 480]);plot(M,results,'LineWidth',1.5);grid on;xlabel('MTOW (kg)');ylabel('Steady endurance (h)'); title('He route: change one modelling boundary at a time');legend(labels,'Interpreter','none','Location','northeastoutside'); r23.save_figure(fig,paths,'He-to-quad-stepwise-migration');close(fig); end