Vous êtes sur la page 1sur 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

Vous aimerez peut-être aussi