File:Am2 spec.gif
Summary
| Description |
English: animated picture showing the spectrum of an amplitude-modulated transmitter. case-1: Frequency changes. case-2: Amplitude changes. MATLAB code |
||
| Date | |||
| Source | programmed by myself | ||
| Author | Herbertweidner (talk) 12:16, 25 January 2013 (UTC) | ||
| Permission (Reusing this file) |
|
filename = 'am2_spek.gif'; %MATLAB code steps = 39; % no of different frames speed = 0.01; % Delay in sec between frames. (Parameter passed to gif-file) x_med = (0 : 0.001 : 2); axis tight; %axis([0 3 -2 2]); % gcf is handle "current figure" set(gcf,'nextplot','replacechildren', 'visible','off'); [im,map] = rgb2ind(f.cdata,256,'nodither'); freq = 3; % tiefste Frequenz for schritt=1:steps %zuerst Frequenz ändern freq=freq-sign(schritt-steps/2-1); ton = sin(freq* 2*pi * x_med ); hold off; fill([0 3 3 0],[-1.5 -1.5 1.5 1.5],'w'); hold on; plot(x_med, ton); line([0,2.1], [0,0], 'Color',[0 0 0]); %Basis links line([2.1,2.05], [0,-.05], 'Color',[0 0 0]); line([2.1,2.05], [0,.05], 'Color',[0 0 0]); text(1,.2,'Time', 'Color',[0 0 0]) line([2.1,2.9], [-1,-1], 'Color',[0 0 0]); %Basis rechts line([2.9,2.85], [-1,-.95], 'Color',[0 0 0]); line([2.9,2.85], [-1,-1.05], 'Color',[0 0 0]); text(2.3,-1.2,'Frequency', 'Color',[0 0 0]) line([2.5,2.5],[-1,1], 'Color',[1 0 0]); %Träger text(2.6,0.9,'Carrier', 'Color',[1 0 0]) delta=0.53*freq/steps; line([2.5+delta,2.5+delta],[-1,0], 'Color',[0 0.9 0]); %USB text(2.6,.3,'USB', 'Color',[0 0.9 0]) line([2.5-delta,2.5-delta],[-1,0], 'Color',[0 0.9 0]); %LSB text(2.2,.3,'LSB', 'Color',[0 0.9 0]) f = getframe(); % get hardcopy im(:,:,1,schritt) = rgb2ind(f.cdata,map,'nodither'); % store to im end fc=schritt+1; %frame counter for schritt=0:steps-2 %nun Amplitude ändern ampl=(cos(schritt*pi/steps))^2; ton = ampl*sin(freq* 2*pi * x_med ); hold off; fill([0 3 3 0],[-1.5 -1.5 1.5 1.5],'w'); hold on; plot(x_med, ton); line([0,2.1], [0,0], 'Color',[0 0 0]); %Basis links line([2.1,2.05], [0,-.05], 'Color',[0 0 0]); line([2.1,2.05], [0,.05], 'Color',[0 0 0]); text(1,.2,'Time', 'Color',[0 0 0]) line([2.1,2.9], [-1,-1], 'Color',[0 0 0]); %Basis rechts line([2.9,2.85], [-1,-.95], 'Color',[0 0 0]); line([2.9,2.85], [-1,-1.05], 'Color',[0 0 0]); text(2.3,-1.2,'Frequency', 'Color',[0 0 0]) line([2.5,2.5],[-1,1], 'Color',[1 0 0]); %Träger text(2.6,0.9,'Carrier', 'Color',[1 0 0]) line([2.5+delta,2.5+delta],[-1,-1+ampl], 'Color',[0 0.9 0]); %USB text(2.6,.3,'USB', 'Color',[0 0.9 0]) line([2.5-delta,2.5-delta],[-1,-1+ampl], 'Color',[0 0.9 0]); %LSB text(2.2,.3,'LSB', 'Color',[0 0.9 0]) f = getframe(); % get hardcopy im(:,:,1,fc) = rgb2ind(f.cdata,map,'nodither'); % store to im fc=fc+1; end % write animation to file imwrite(im, map, filename, 'DelayTime',speed, 'LoopCount',inf) %endCategory:Modulation
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
| This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
| The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
|