t=(1:100)'; s=sin(2*pi*t/10); plot(t,s) s=sin(2*pi*t/20); plot(t,s) figure(2) plot(abs(fftshift(fft(s)))) plot(abs(fftshift(fft(s+1)))) plot(-49:50, abs(fftshift(fft(s+1)))) plot(-50:49, abs(fftshift(fft(s+1)))) plot(-50:49, abs(fftshift(fft(s)))) plot(abs(fft(s))) edit fftshift plot(-50:49, abs(fftshift(fft(s)))) semilogy(-50:49, abs(fftshift(fft(s)))) s2=sin(2*pi*t/19); figure(1) plot(t,s2) plot(t,s2,t,s) figure(2) hold on semilogy(-50:49, abs(fftshift(fft(s2)))) desiredPropNames = 'ALim' 'ALimMode' 'AmbientLightColor' 'BeingDeleted' 'Box' 'BusyAction' 'ButtonDownFcn' 'CameraPosition' 'CameraPositionMode' 'CameraTarget' 'CameraTargetMode' 'CameraUpVector' 'CameraUpVectorMode' 'CameraViewAngle' 'CameraViewAngleMode' 'Children' 'CLim' 'CLimMode' 'Clipping' 'Color' 'ColorOrder' 'CreateFcn' 'CurrentPoint' 'DataAspectRatio' 'DataAspectRatioMode' 'DeleteFcn' 'DrawMode' 'FontAngle' 'FontName' 'FontSize' 'FontUnits' 'FontWeight' 'GridLineStyle' 'HandleVisibility' 'HitTest' 'Interruptible' 'Layer' 'LineStyleOrder' 'LineWidth' 'MinorGridLineStyle' 'NextPlot' 'Parent' 'PlotBoxAspectRatio' 'PlotBoxAspectRatioMode' 'Position' 'Projection' 'Selected' 'SelectionHighlight' 'Tag' 'TickDir' 'TickDirMode' 'TickLength' 'Title' 'Type' 'UIContextMenu' 'Units' 'UserData' 'View' 'Visible' 'XAxisLocation' 'XColor' 'XDir' 'XGrid' 'XLabel' 'XLim' 'XLimMode' 'XMinorGrid' 'XMinorTick' 'XScale' 'XTick' 'XTickLabel' 'XTickLabelMode' 'XTickMode' 'YAxisLocation' 'YColor' 'YDir' 'YGrid' 'YLabel' 'YLim' 'YLimMode' 'YMinorGrid' 'YMinorTick' 'YScale' 'YTick' 'YTickLabel' 'YTickLabelMode' 'YTickMode' 'ZColor' 'ZDir' 'ZGrid' 'ZLabel' 'ZLim' 'ZLimMode' 'ZMinorGrid' 'ZMinorTick' 'ZScale' 'ZTick' 'ZTickLabel' 'ZTickLabelMode' 'ZTickMode' desiredPropNames = 'ALim' 'ALimMode' 'AmbientLightColor' 'BeingDeleted' 'Box' 'BusyAction' 'CLim' 'CLimMode' 'CameraPosition' 'CameraPositionMode' 'CameraTarget' 'CameraTargetMode' 'CameraUpVector' 'CameraUpVectorMode' 'CameraViewAngle' 'CameraViewAngleMode' 'Children' 'Clipping' 'Color' 'ColorOrder' 'DataAspectRatio' 'DataAspectRatioMode' 'DrawMode' 'FontAngle' 'FontName' 'FontSize' 'FontUnits' 'FontWeight' 'GridLineStyle' 'HandleVisibility' 'HitTest' 'Interruptible' 'Layer' 'LineStyleOrder' 'LineWidth' 'MinorGridLineStyle' 'NextPlot' 'Parent' 'PlotBoxAspectRatio' 'PlotBoxAspectRatioMode' 'Position' 'Projection' 'SelectionHighlight' 'Tag' 'TickDir' 'TickDirMode' 'TickLength' 'Title' 'Type' 'UIContextMenu' 'Units' 'View' 'Visible' 'XAxisLocation' 'XColor' 'XDir' 'XGrid' 'XLabel' 'XLim' 'XLimMode' 'XMinorGrid' 'XMinorTick' 'XScale' 'XTick' 'XTickLabel' 'XTickLabelMode' 'XTickMode' 'YAxisLocation' 'YColor' 'YDir' 'YGrid' 'YLabel' 'YLim' 'YLimMode' 'YMinorGrid' 'YMinorTick' 'YScale' 'YTick' 'YTickLabel' 'YTickLabelMode' 'YTickMode' 'ZColor' 'ZDir' 'ZGrid' 'ZLabel' 'ZLim' 'ZLimMode' 'ZMinorGrid' 'ZMinorTick' 'ZScale' 'ZTick' 'ZTickLabel' 'ZTickLabelMode' 'ZTickMode' semilogy(-50:49, abs(fftshift(fft(s2)))) desiredPropNames = 'ALim' 'ALimMode' 'AmbientLightColor' 'BeingDeleted' 'Box' 'BusyAction' 'ButtonDownFcn' 'CameraPosition' 'CameraPositionMode' 'CameraTarget' 'CameraTargetMode' 'CameraUpVector' 'CameraUpVectorMode' 'CameraViewAngle' 'CameraViewAngleMode' 'Children' 'CLim' 'CLimMode' 'Clipping' 'Color' 'ColorOrder' 'CreateFcn' 'CurrentPoint' 'DataAspectRatio' 'DataAspectRatioMode' 'DeleteFcn' 'DrawMode' 'FontAngle' 'FontName' 'FontSize' 'FontUnits' 'FontWeight' 'GridLineStyle' 'HandleVisibility' 'HitTest' 'Interruptible' 'Layer' 'LineStyleOrder' 'LineWidth' 'MinorGridLineStyle' 'NextPlot' 'Parent' 'PlotBoxAspectRatio' 'PlotBoxAspectRatioMode' 'Position' 'Projection' 'Selected' 'SelectionHighlight' 'Tag' 'TickDir' 'TickDirMode' 'TickLength' 'Title' 'Type' 'UIContextMenu' 'Units' 'UserData' 'View' 'Visible' 'XAxisLocation' 'XColor' 'XDir' 'XGrid' 'XLabel' 'XLim' 'XLimMode' 'XMinorGrid' 'XMinorTick' 'XScale' 'XTick' 'XTickLabel' 'XTickLabelMode' 'XTickMode' 'YAxisLocation' 'YColor' 'YDir' 'YGrid' 'YLabel' 'YLim' 'YLimMode' 'YMinorGrid' 'YMinorTick' 'YScale' 'YTick' 'YTickLabel' 'YTickLabelMode' 'YTickMode' 'ZColor' 'ZDir' 'ZGrid' 'ZLabel' 'ZLim' 'ZLimMode' 'ZMinorGrid' 'ZMinorTick' 'ZScale' 'ZTick' 'ZTickLabel' 'ZTickLabelMode' 'ZTickMode' desiredPropNames = 'ALim' 'ALimMode' 'AmbientLightColor' 'BeingDeleted' 'Box' 'BusyAction' 'CLim' 'CLimMode' 'CameraPosition' 'CameraPositionMode' 'CameraTarget' 'CameraTargetMode' 'CameraUpVector' 'CameraUpVectorMode' 'CameraViewAngle' 'CameraViewAngleMode' 'Children' 'Clipping' 'Color' 'ColorOrder' 'DataAspectRatio' 'DataAspectRatioMode' 'DrawMode' 'FontAngle' 'FontName' 'FontSize' 'FontUnits' 'FontWeight' 'GridLineStyle' 'HandleVisibility' 'HitTest' 'Interruptible' 'Layer' 'LineStyleOrder' 'LineWidth' 'MinorGridLineStyle' 'NextPlot' 'Parent' 'PlotBoxAspectRatio' 'PlotBoxAspectRatioMode' 'Position' 'Projection' 'SelectionHighlight' 'Tag' 'TickDir' 'TickDirMode' 'TickLength' 'Title' 'Type' 'UIContextMenu' 'Units' 'View' 'Visible' 'XAxisLocation' 'XColor' 'XDir' 'XGrid' 'XLabel' 'XLim' 'XLimMode' 'XMinorGrid' 'XMinorTick' 'XScale' 'XTick' 'XTickLabel' 'XTickLabelMode' 'XTickMode' 'YAxisLocation' 'YColor' 'YDir' 'YGrid' 'YLabel' 'YLim' 'YLimMode' 'YMinorGrid' 'YMinorTick' 'YScale' 'YTick' 'YTickLabel' 'YTickLabelMode' 'YTickMode' 'ZColor' 'ZDir' 'ZGrid' 'ZLabel' 'ZLim' 'ZLimMode' 'ZMinorGrid' 'ZMinorTick' 'ZScale' 'ZTick' 'ZTickLabel' 'ZTickLabelMode' 'ZTickMode' figure(3) plot([t;t],[s2;s2]) plot([s2;s2]) figure; plot(t,triangle(2*pi*t)) ??? Undefined function or variable 'triangle'. figure; plot(t,tri(2*pi*t)) ??? Undefined function or variable 'tri'. help triangle triangle.m not found. tri=[0:49,48:1] tri = Columns 1 through 18 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Columns 19 through 36 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Columns 37 through 50 36 37 38 39 40 41 42 43 44 45 46 47 48 49 tri=[0:49,48:-1:0] tri = Columns 1 through 18 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Columns 19 through 36 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Columns 37 through 54 36 37 38 39 40 41 42 43 44 45 46 47 48 49 48 47 46 45 Columns 55 through 72 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 Columns 73 through 90 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 Columns 91 through 99 8 7 6 5 4 3 2 1 0 tri=[0:50,49:-1:1] tri = Columns 1 through 18 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Columns 19 through 36 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Columns 37 through 54 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 49 48 47 Columns 55 through 72 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 Columns 73 through 90 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 Columns 91 through 100 10 9 8 7 6 5 4 3 2 1 tri=[0:50,49:-1:1]/50 tri = Columns 1 through 11 0 0.0200 0.0400 0.0600 0.0800 0.1000 0.1200 0.1400 0.1600 0.1800 0.2000 Columns 12 through 22 0.2200 0.2400 0.2600 0.2800 0.3000 0.3200 0.3400 0.3600 0.3800 0.4000 0.4200 Columns 23 through 33 0.4400 0.4600 0.4800 0.5000 0.5200 0.5400 0.5600 0.5800 0.6000 0.6200 0.6400 Columns 34 through 44 0.6600 0.6800 0.7000 0.7200 0.7400 0.7600 0.7800 0.8000 0.8200 0.8400 0.8600 Columns 45 through 55 0.8800 0.9000 0.9200 0.9400 0.9600 0.9800 1.0000 0.9800 0.9600 0.9400 0.9200 Columns 56 through 66 0.9000 0.8800 0.8600 0.8400 0.8200 0.8000 0.7800 0.7600 0.7400 0.7200 0.7000 Columns 67 through 77 0.6800 0.6600 0.6400 0.6200 0.6000 0.5800 0.5600 0.5400 0.5200 0.5000 0.4800 Columns 78 through 88 0.4600 0.4400 0.4200 0.4000 0.3800 0.3600 0.3400 0.3200 0.3000 0.2800 0.2600 Columns 89 through 99 0.2400 0.2200 0.2000 0.1800 0.1600 0.1400 0.1200 0.1000 0.0800 0.0600 0.0400 Column 100 0.0200 figure(2) hold on plot(-50:49, abs(fftshift(fft(tri.*s2)))) ??? Error using ==> .* Matrix dimensions must agree. plot(-50:49, abs(fftshift(fft(tri'.*s2)))) desiredPropNames = 'BeingDeleted' 'BusyAction' 'ButtonDownFcn' 'CallbackObject' 'Children' 'Clipping' 'CommandWindowSize' 'CreateFcn' 'CurrentFigure' 'DeleteFcn' 'Diary' 'DiaryFile' 'Echo' 'FixedWidthFontName' 'Format' 'FormatSpacing' 'HandleVisibility' 'HitTest' 'Interruptible' 'Language' 'More' 'Parent' 'PointerLocation' 'PointerWindow' 'RecursionLimit' 'ScreenDepth' 'ScreenSize' 'Selected' 'SelectionHighlight' 'ShowHiddenHandles' 'Tag' 'Type' 'UIContextMenu' 'Units' 'UserData' 'Visible' desiredPropNames = 'BeingDeleted' 'BusyAction' 'Children' 'Clipping' 'CommandWindowSize' 'Diary' 'DiaryFile' 'Echo' 'FixedWidthFontName' 'Format' 'FormatSpacing' 'HandleVisibility' 'HitTest' 'Interruptible' 'Language' 'More' 'Parent' 'ScreenDepth' 'ScreenSize' 'SelectionHighlight' 'Tag' 'Type' 'UIContextMenu' 'Units' 'Visible' diary