CS 113
Summer 2015
Lab07
Cell Arrays & Structures
Important:
For each question, open a new script (.m file) and name it
YourLastname_firstname_Lab07_QuestionNumber.m
( Ex: akgun_ali_Lab07_Q1a.m )
Do not use Turkish characters in file names.
At the end of
CS113 SAMPLE EXAM QUESTIONS
1. Please write down the below problem in Matlab commands.
(sin(pi/6)sqrt(4)/(exp(4.4)+log(200)
2. Please write down a single command to compute the cosine of 7 linearly, equally spaced
degrees between 0 and 90.
x=cosd(linspa
CS113 SAMPLE EXAM QUESTIONS
1. Please write down the below problem in Matlab commands.
2. Please write down a single command to compute the cosine of 7 linearly, equally spaced
degrees between 0 and 90.
3. For the given vectors a and b, evaluate the vect
CS 113
Summer 2015
Lab09
Important:
For each question, open a new script (.m file) and name it
YourLastname_firstname_Lab01_QuestionNumber.m(ex:akgun_ali_Lab01_q1b.m
)
Do not use Turkish characters in file names.
At the end of the lab zip your mfiles wit
CS 113
Summer 2015
Lab 06 : Functions
Solutions
Solution 1 (25 pnts)
function throwUntil(x)
r = 0;
cnt = 0;
fprintf ('Dices:\n ');
while r ~= x
r = randi(6);
fprintf ('0 ',r);
cnt = cnt +1 ;
end
fprintf('\nYou hit number 0 after throwing 0 dices.\n', x, c
CS 113
Summer 2015
Lab 06
Functions
Important:
For each question, open a new script (.m file) and name it
YourLastname_firstname_Lab01_QuestionNumber.m (ex: akgun_ali_Lab01_q1b.m )
Do not use Turkish characters in file names.
At the end of the lab zip you
CS 113
Summer 2015
Lab 05
Execution Control 2 (Loops)
Important:
For each question, open a new script (.m file) and name it
Lastname_firstname_Lab01_QuestionNumber.m(ex:akgun_ali_Lab01_q1b.m )
Do not use Turkish characters in file names.
At the end of the
CS 113
Summer 2015
Lab 03
Matrix Operations
Important:
For each question, open a new script (.m file) and name it
YourLastname_firstname_Lab01_QuestionNumber.m(ex:akgun_ali_Lab01_q1b.m )
Do not use Turkish characters in file names.
At the end of the lab z
CS 113
Summer 2015
Lab04
Execution Control 2 (Loops)
Solutions
Question 1 (25 points)
clear;
clc;
sum = 0;
n = 1;
while sum < 1000
sum = sum + (1)^n * n^3;
n = n+1;
end
disp( ['When n is ' num2str(n1) ' the sum is ' num2str(sum)]);
% Answer:
% n = 14 su
CS 113 Lab04
Summer 2015
Execution Control 1 (Ifswitch)
Solutions
%problem 1 ( 25 Points ) :
clc
clear
lowerLeft = input('Enter the coordinates of the lowerleft point of the rectangle: ');
upperRight = input('Enter the coordinates of the upperright poi
CS113 Introduction to Computing for Engineers
Spring 201516 Class Syllabi
Course Content
The students will be expected to be familiar with the following concepts, such as programming
with MATLAB, basic data manipulation, MATLAB user interface, scripts, v
CS 113 Introduction to Computing for Engineers
Laboratory Assignment 5
hsan Doramac Bilkent University
Fall 2015

For each question, open a new script (.m file) and name it Lastname_Firstname_Lab01_QuestionNumber.m (e.g.
ustuner_asli_Lab01_Q1b.m)

At th
clc; clear; close all;
% Question 1
a = 1;
b = 0;
x = 2;
f1 = (x/(a^2) * exp((xb)^2)/(2*a^2);
% 0.2707
x = 2;
f2 = (x/(a^2) * exp((xb)^2)/(2*a^2);
f1 = f2
% 0.2707
g = cosd(135)/cos(pi/4)
h = sqrt(log(exp(1)^18)/ log10(100)
% g = 1
% h = 3
% Quest
CS113
REVIEW EXAMPLES
1. The array A is given as follows:
A=
1
2 3
4
5
6 7
8
9 10 11 12
Write a single MATLAB command that will set the variables Y and X
equal to the indicated portion of array A:
Y=
1
MATLAB Command: Y =A(1,[1 2 3])
2
3
X=
1
2
3
9 10 11
CS 113 Lab 05
Spring 2016
For each question, open a new script (.m file) and name it
YourLastname_firstname_Lab01_QuestionNumber.m (ex: akgun_ali_Lab01_q1b.m )
Do not use Turkish characters in file names.
At the end of the lab zip your mfiles with YourLa
CS 113 Lab 01
Spring 201516
Getting Started & Vectors, Arrays
Important:
For each question, open a new script (.m file) and name it
YourLastname_firstname_Lab01_QuestionNumber.m (ex: akgun_ali_Lab01_q1b.m )
Do not use Turkish characters in file names.
At
LAB RULES
Students are required to attend the weekly lab sessions and complete all assignments.
Students who are more than one hour late without a valid excuse wont be allowed to do
that lab assigments.
Students should not leave their smart phones on thei
SAMPLE MIDTERM
Question 1
a) (4pts) Please write down the result of the below operation if written in MATLAB command
window.
(104/2^2*5+1)*6 / 3^2*2 =
b) (5pts) Please write down the below problem in MATLAB commands.
ln 6
tan(
2
cos 60
5
7
)
e i
c) (4
Write a Matlab function called Count_range
that counts the number of values in a given
double array ARR (first input argument)
between the given value A as second input
argument and another given value B as third
input argument
in the range [A,B], inclus
CS 113
Summer 2015
Lab02
Vectors and Matrices
Important:
For each question, open a new script (.m file) and name it
YourLastname_firstname_Lab02_QuestionNumber.m(ex:akgun_ali_Lab02_Q1b.m )
Do not use Turkish characters in file names.
At the end of the lab
CS 113
Summer 2015
Lab04
Execution Control 1 (Ifswitch)
Important:
For each question, open a new script (.m file) and name it
YourLastname_firstname_Lab01_QuestionNumber.m(ex:akgun_ali_Lab01_q1b.m )
Do not use Turkish characters in file names.
At the end
CS 113 Lab 03
Fall 201415
Execution Control 1: Conditional Statements
Important:
For each question, open a new script (.m file) and name it
YourLastname_firstname_Lab01_QuestionNumber.m (ex: akgun_ali_Lab01_q1b.m )
Do not use Turkish characters in file n
CS 113 Lab 01
Fall 201415
Vectors and Matrices
Important:
For each question, open a new script (.m file) and name it
YourLastname_firstname_Lab01_QuestionNumber.m (ex: akgun_ali_Lab01_q1b.m )
Do not use Turkish characters in file names.
At the end of the