[exercises] add a plotting task to logicalindexing exercise

This commit is contained in:
2018-10-22 17:26:11 +02:00
parent c2dfa9ab47
commit ab562915e1
2 changed files with 36 additions and 14 deletions

View File

@@ -62,9 +62,11 @@ following pattern: ``variables\_datatypes\_\{lastname\}.m''
\part Execute and explain: \verb+bitand(10, 8)+
\part Execute and explain: \verb+bitor(10, 8)+
\end{parts}
\item Implement the following Boolean expressions. Test using randomly selected integer values for \verb+x+ and \verb+y+.
\item Implement the following Boolean expressions. Test your
implementations using random integer
numbers for \verb+x+ and \verb+y+ (\verb+randi+).
\begin{parts}
\part The result should be \verb+true+ if \verb+x+ greater than \verb+y+ and the sum of \verb+x+ and \verb+y+ is not less than 100.
\part The result should be \verb+true+ if \verb+x+ is greater than \verb+y+ and the sum of \verb+x+ and \verb+y+ is not less than 100.
\part The result should be \verb+true+ if \verb+x+ and \verb+y+ are not equal zero or \verb+x+ and \verb+y+ are equal.
\end{parts}
\end{questions}
@@ -82,7 +84,7 @@ matrices that match in certain criteria. This process is called
the following commands and explain.
\begin{parts}
\part \verb+x < 5+
\part \verb+x( x < 5) )+
\part \verb+x( (x < 5) )+
\part \verb+x( (y <= 2) )+
\part \verb+x( (x > 2) | (y < 8) )+
\part \verb+x( (x == 0) & (y == 0) )+
@@ -94,6 +96,19 @@ matrices that match in certain criteria. This process is called
\verb+x >= 33 and x < 66+ to 1 and all \verb+x >= 66+ to 2.
\part Count the number of elements in each class using Boolean expressions (\verb+sum+ can be used to count the matches).
\end{parts}
\question Plotting a periodic signal.
\begin{parts}
\part Load the file ``signal.mat'' into the workspace (use
\verb+load('signal.mat')+ or use the UI for it). It contains two
variables \verb+signal+ and \verb+time+. The signal has a period of
0.2\,s
\part What is the size of the data?
\part What is the temporal resolution of the time axis?
\part Plot the full data. Make sure that the axes are properly labeled (script chapter 3, or the matlab documentation).
\part Use logical indexing to select the periods individually and plot them into the same plot (first period starts at time 0.0\,s, the next at 0.2\,s and so on).
\end{parts}
\end{questions}
\end{document}