Output simple function matlab Hello_sarra - Dernière réponse le 20 mars 2013 1 réponse function y=fcv(w,h,k,T) if w>0 y= w.^2.*exp(h*w./(k*T))./(exp(h*w./(k*T))-1).^2; %% or w>0 only else y=0; %%% Quand w=0 end le problem quand je prend w=[0,1,2,3,4]; et je tape dans windows Matlab h=1; T=1; k=1; y=fcv(w,h,k,T) mais je nobtiens pas y l'output Afficher la suite 1 réponse Trié par votes Votes Date Date décroissante Réponse 1 / 1 Krys_06 Tu ne peux pas mélanger de la vectorisation avec un "if (w > 0)". En revanche, tu peux faire quelque chose du style: function y = fcv (w,h,k,T) y = zeros(size(w)); y(w>0)= w(w>0).^2.*exp(h*w(w>0)./(k*T))./(exp(h*w(w>0)./(k*T))-1).^2; end Discussions similaires Pas de son, pilote realtek pyth VLC Direct 3D output hightechfan Realtek Audio High Definition ne fonctionne pas Noxon Realtek Digital Output AlexQC Sujet Précédent Sujet Suivant
Réponse 1 / 1 Krys_06 Tu ne peux pas mélanger de la vectorisation avec un "if (w > 0)". En revanche, tu peux faire quelque chose du style: function y = fcv (w,h,k,T) y = zeros(size(w)); y(w>0)= w(w>0).^2.*exp(h*w(w>0)./(k*T))./(exp(h*w(w>0)./(k*T))-1).^2; end