BCEE 231 Homework SET #1
P1.1 (25 marks)
Given the first two coefficients
=
a0 0=
& a1 1 , the subsequent
coefficients are to be generated by the following recurrence relation 1:
an =
an 1 + an 2
for n =
2,3,
Write the computer program that produces the f
HW#2
Problem 1
The square root of a value V can be found using either one of the
following iterative formulas:
Formula (A)
r2
1
V
r1
2
r1
Formula (B)
r2
r1 (r12 3V )
3r12 V
where r1 is the previously estimated root.
Your task is to find out which of
BCEE231 Programming for Building and Civil Engineers
Assignment #1
Catherine Nguyen (7384971)
Tutorial section M MA
Professor Sangsoo Han
Due date:
10 October 2014
Summary
P1.1
a) The problem asks to show that the equation E1 will be equal to 0.5 as x app
BCEE 231 Homework Set #2
P2.1 (15 marks)
Complete the following functions to accomplish the tasks specified in
the program:
Ln(float xo, float Err)
cfw_ /* Compute and return ln(xo+1) (with Estimated Error
less than Err) using the recurrence relation in A
SAMPLE EXAMINATION QUESTIONS Chapter 1
The midterm (final exam) will have up to 8 (25) questions for 1 (3) hours. Adjacent students will have
different exams.
Special instructions: Closed book. No calculators. A nonelectronic dictionary is permitted.
A)
BCEE 231 Homework Set #3
P3.1 (40 marks)
Complete the following program to accomplish the tasks 1 specified in the program
documentation.
main()
cfw_
/ Define array elements, row by row:
defmat(M[NR = 4, NC = 3],
67, 46, 70,
59, 66, 68,
54, 68, 88,
78, 69
SAMPLE EXAMINATION QUESTIONS Chapter 1
The midterm (final exam) will have up to 8 (25) questions for 1 (3) hours. Adjacent students will have
different exams.
Special instructions: Closed book. No calculators. A nonelectronic dictionary is permitted.
A)
9/10/2015
Chapter1
Fundamentals of
Procedural Programming
Computer/Hardware/Program/Software
A computer performs computations and
makes logical decisions.
Hardware are physical devices of a computer.
A computer program is a set of rules and
instruction
SAMPLE EXAMINATION QUESTIONS Chapter 2
The midterm (final exam) will have up to 8 (25) questions for 1 (3) hours. Adjacent students will have
different exams.
Special instructions: Closed book. No calculators. A nonelectronic dictionary is permitted.
A)
SAMPLE EXAMINATION QUESTIONS Chapter 3
The midterm (final exam) will have up to 8 (25) questions for 1 (3) hours. Adjacent
students will have different exams.
Special instructions: Closed book. No calculators. A nonelectronic dictionary is
permitted.
A)
BCEE 231_M HW #1
Problem 1
The following function f ( x) can be expressed in two different but
equivalent forms as follows:
1
1 cos x
x2
1 sin 2 x
E2 f ( x) 2
x 1 cos x
E1 f ( x)
Note that E1 uses subtraction whereas E2 does not.
(a)
Write a program:
BCEE 231 Assignment Set #1
P1.1 (30 marks)
A ball is dropped from a helicopter at the
height h1 = 450 m. When it touches the
ground, its vertical velocity is V1 = 2 gh1
h1
h2
where g = 9.81 m/s2. The ball bounces
off the ground with the vertical velocity
BCEE 231 Assignment Set #2
P2.1 (30 marks)
Complete the following functions to accomplish the tasks specified in
the program:
Ln(float xo, float Err)
cfw_ /* Compute and return ln(xo+1) (with Estimated Error
less than Err) using the recurrence relation in
SqrtA(float V, float r1, float Error)
cfw_/ return the square root of A with with Error no less than Err
r1 = V/2;
kA = 0; / counter of number of iteration for formula 1
docfw_
kA = kA+1;
r2 = (1/2)*(r1+V/r1); / hoping r1 different from 0
Abs = abs(r1r2)
19/09/2014
Sections 2.12.9: Program
Design and Control
Structures
1
2.1 Programs and Programming
Computer Programs
set of instructions or steps for the computer to perform to accomplish specified
tasks.
Computer Programming
process of organizing, plannin
03/10/2014
Lecture 5
Chapter 3
Customized Power Tools:
UserDefined Functions
3.1 Intro
3.2 Task division
3.3 Functions for repeated use
3.4 Writing and using functions
3.5 Execute and Activate UDFs
1
User Defined Function
Divide and Conquer
Divide big p
Department of Building, Civil and Environmental Engineering
BCEE 231: STRUCTURED PROGRAMMING AND APPLICATIONS
FOR BUILDING AND CIVIL ENGINEERS 3 CREDITS
Prerequisite: MATH 204; ENGR 242 previously or concurrently
Changes to the information in the course o
BCEE 231: Structured Programming
and Applications for Building and
Civil Engineers
Introductory remarks
Dr. Ali Nazemi
Department of Building, Civil and Environmental Engineering
Friday 8th September 2017
Concordia University
Montreal, Quebec
When and whe
BCEE 231: Lecture1
Introduction to MATLAB
programming
Dr. Ali Nazemi
Department of Building, Civil and Environmental Engineering
Friday 8th September 2017
Concordia University
Montreal, Quebec
1
Why do we need to learn programming as
civil engineers?
Sto
BCEE 231 Homework Set #1
Due date: Friday October 13
Check the course outline for the procedure of submission
P1 (25%). Figure 1 shows the geometry formulas for common 2D
shapes. Write a MATLAB program that ask the user about the shape, as well
as corres
main()
cfw_
P=150000; / Force
E=205000; / Elasticity modulus of steel
t=7; / Millimeters
L=5000; /Length of beam
b=getnum("Enter value of b"); / Ultimate solution would be for a function to randomly generate values
d=getnum("Enter value of d"); /
Using compound logical expressions to plot a graph of multiple equations and values of x.
Can be written as:
plot(x,0,14,
y = (2*x/3) * (x >= 0 & x <= 3) + ((x3)/2+3) * (x > 3 & x
<= 7)
+ (0.6*(x7)^2+3.2*(x7)2) * (x>7 & x<=12)
+ (x12)/21) * (x > 1
2.3 The if/else Control Structure for Conditional Actions
if(Expr)
cfw_
. / TRUEblock
else
cfw_
. / ELSEblock (optional)
. / OTHERstatement
If the value of Expr is nonzero (i.e. TRUE), the statements in the TRUEblock will be
executed or else the st
Creation of Array Variables
A variable (both float & mat) can be global or local:
Global (visible to all functions): This is either by explicit declaration or by default (used in main() )
Local to a particular function: This must be by explicit declarat
LOCAL/GLOBAL VARIABLES (continued)
When the program has only ONE function [i.e. main()], we don't really care if all data is global.
Things change when we have many userdefined functions. To reduce the chance of errors, we
should use local variables in f
structured programming and applications for building and civil engineer
BCEE 231

Fall 2016
P2.1
SqrtA(float V, float r1, float Error) / Square root function using the formula A
cfw_
KA=0;
for (i=1;i>0;i=i+1)
cfw_
r1 = 0.5*(r1 + V/r1); /r1 will constantly change
KA = i;
if(abs(sqrt(V)r1) <= Error) /Verifies if
cfw_
return r1;
break
SqrtB(flo