עוד שאלה של יעילות Matlab
function r=modulator (real,imag,time,ShapeAmplitude,SymbolRate,CarrierFreq,theta) % real == the real part of the symbol to be transmitted % imag == same % time == the Time Vector % ShapeAmplitude == used to set the amplitude of g(t) -- the transmit filter % SymbolRate == the rate of transmition of symblos [ sym/sec ] % CarrierFreq == the fc in Sin(2pi*fc*t+theta) , Cos(2*pi*fc*t+theta) % theta == look up Sdi=zeros(1,length(time)); Sdq=zeros(1,length(time)); %% check lectuer for i=1:length(real) %% same as length(imag) Sdi=Sdi+real(i).*ShapeFilter(time,i-1,ShapeAmplitude,1/SymbolRate); Sdq=Sdq+imag(i).*ShapeFilter(time,i-1,ShapeAmplitude,1/SymbolRate); i end r=Sdi.*cos(2*pi*CarrierFreq*time+theta) - Sdq.*sin(2*pi*CarrierFreq*time+theta);
השאלה היא: במקום הלולאה שמתבצעת 10000 פעמים (כך זה יוצא), האם ניתן לכתוב משהו מהיר יותר כמו כפל וקטורים. בקובץ מצורפת הפונקציה של ShapeFilter