0% found this document useful (0 votes)
12 views

Example File For Returning Matlab

tutorial

Uploaded by

Hilbert
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Example File For Returning Matlab

tutorial

Uploaded by

Hilbert
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

%% Example file for returning Matlab-exercises

%% Task1
% Here, in the beginning, you can write nice comments and explanations
% with Latex-commands.
%
% In this task we calculate and plot function
%
% $$f_n(x) = \sum_{k=1}^n cos(kx). $$
%
% Function $f_n(x)$ is defined as Matlab-function f inside script file.
%
% After this, in this block comments are "normal" comments and
% Latex-commands won't work.
clear all
close all
n = 3
x =linspace(0,2*pi,100);

y = f(x,n); % calculates funktion f_n(x)


figure
plot(x, y);
snapnow % needed to ensure that in published pdf-file the figure is shown

You might also like