Matlab Exam 2

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is needed in 01? <01> = 'mountainHeights.txt' ; [ fileID , errorMsg ] = <02> (FILENAME , 'r' ); if <03> > 0 aNum = <04> (fileID, %f, 1); <05> disp (<06>) end

FILENAME

Matlab has a constant "pi" What are the results of sin(pi)?

1.2246e-016

s = 0; sum = 0; while s <= 12 sum = sum + s s = s + 4; end fprintf( ' sum = %.0f \s' , sum)

24

What is the value in aNum? sum = 0; for aNum = [ 1, 3 , 7 ] sum = sum + aNum; end disp (aNum)

7

What is needed in 05? <01> = 'mountainHeights.txt' ; [ fileID , errorMsg ] = <02> (FILENAME , 'r' ); if <03> > 0 aNum = <04> (fileID, %f, 1); <05> disp (<06>) end

else

What is needed in 06? <01> = 'mountainHeights.txt' ; [ fileID , errorMsg ] = <02> (FILENAME , 'r' ); if <03> > 0 aNum = <04> (fileID, %f, 1); <05> disp (<06>) end

errorMsg

What is needed in 03? <01> = 'mountainHeights.txt' ; [ fileID , errorMsg ] = <02> (FILENAME , 'r' ); if <03> > 0 aNum = <04> (fileID, %f, 1); <05> disp (<06>) end

fileID

linspace

first number, last number, how many

What is needed in 02? <01> = 'mountainHeights.txt' ; [ fileID , errorMsg ] = <02> (FILENAME , 'r' ); if <03> > 0 aNum = <04> (fileID, %f, 1); <05> disp (<06>) end

fopen

What is needed in 04? <01> = 'mountainHeights.txt' ; [ fileID , errorMsg ] = <02> (FILENAME , 'r' ); if <03> > 0 aNum = <04> (fileID, %f, 1); <05> disp (<06>) end

fscanf

sprintf vs fprintf

sprintf gets saved in a string and fprintf gets put directly into the command window

x = 0; for n = 1:3 for m = 1:2 myArray(n,m) = x x = x + 5 end end disp (myArray( 2 , 2 ))

0 5 10 *15* 20 25


Set pelajaran terkait

Intro to Computers- Chapter 4 Key Terms

View Set

Nurs 4 - RN EAQ's -QSEN: Patient Centered Care

View Set

Chapter 10: Payroll Computations, Records, and Payments

View Set

Lección 8: Recapitulaión y Prueba de práctica

View Set

Chapter 15 positioning --fractures

View Set