DSP Lab. Week 1 Drawing sinusoidal waves

Slides:



Advertisements
Similar presentations
Factorial Preparatory Exercise #include using namespace std; double fact(double); int fact(int); int main(void) { const int n=20; ofstream my_file("results.txt");
Advertisements

Tinaliah, S. Kom.. * * * * * * * * * * * * * * * * * #include using namespace std; void main () { for (int i = 1; i
CS 1620 File I/O. So far this semester all input has been from keyboard all output has been to computer screen these are just two examples of where to.
CS-1030 Dr. Mark L. Hornick 1 IOStreams revisited Streams, strings, and files.
1 Engineering Problem Solving With C++ An Object Based Approach Chapter 4 Programming with Data Files.
1 Programming with Data Files Chapter 4 2 Standard Input Output C++ Program Keyboard input cin Output Screen cout.
1 Programming with Data Files Chapter 4. 2 Standard Input Output C++ Program Keyboard input cin Output Screen cout.
Programming with Data Files Chapter 4. Standard Input Output C++ Program Keyboard input cin Output Screen cout.
Upcoming Events Project Check Due Next Week in Lab –Phase I –main(), menu() Functions and Reading in File –Stub Functions Last Lectures Next Week –Project.
CSC 107 – Programming For Science. Today’s Goal ALL  Understand why ALL I/O is file I/O  Common bugs to avoid when coding with files in C++  Get a.
Lectures for cross-layer design (swallow, but, enough to understand the other) Wed Uhr Doug Young Suh Media Lab. Last update : May.
DSP Lab. Week 5 complex Doug Young Suh Media Lab. Rm401 Last update : September 16, 2015.
Tracing through E01, question 9 – step 1 // p02.cc P. Conrad, for CISC181 07S // Exam question for E01 #include using namespace std; void mysteryFunction(int.
File I/O in C++ II. Open() function Open() is a member function in each classes ( fstream, ifstream, ofstream) Void fstream :: open ( const char *filename,
FILE I/O IN C++. Using Input/Output Files A computer file  is stored on a secondary storage device (e.g., disk);  is permanent;  can be used to provide.
Multimedia Systems MW 12:00-13:15, Rm445 Doug Young Suh Media Lab. Rm401 Last update : August 30, 2015.
Chapter 8CS 140 Using The C++ Standard string Class #include #include using namespace std; void main() { string firstName = "Fred"; string lastName =
File Handling in C++.
CSCI 333 Data Structures I/O with C++ 20 October, 2003.
File I/O in C++. Using Input/Output Files A computer file  is stored on a secondary storage device (e.g., disk);  is permanent;  can be used to provide.
File I/O in C++ I. Using Input/Output Files A computer file is stored on a secondary storage device (e.g., disk); is permanent; can be used to provide.
1 Structure of Simple C++ Program Chapter 1 09/09/13.
MR. CRONE Generating Random Numbers. Random Numbers Many programs require the computer to generate random numbers Random numbers are used in many applications.
Basic file operations in C++ Dr. Ahmed Telba 1. 2 Learning Objectives §C++ I/O streams. §Reading and writing sequential files. §Reading and writing random.
Chapter 1. Experiments and Probabilities Doug Young Suh Media Lab.
DSP Lab. Week 2 Matrix multiplication Doug Young Suh Media Lab. Rm401 Last update : September 9, 2015.
DSP Lab. Week 2 Matrix multiplication Doug Young Suh Media Lab. Rm401 Last update : September 9, 2015.
File Processing.
MT262A Review.
Jeff West - Quiz Section 2
File Processing in C++ Data is stored in files so that it may be retrieved for processing when needed.
Basic file operations in C++
Prog Club Introductory Presentation
EMT 101 – Engineering Programming
Intro to Programming Week # 6 Repetition Structure Lecture # 10
Lecture 9 Files, Pointers
Problems With Character Arrays
Math Library and IO formatting
Parallel Arrays Parallel array =>Two or more arrays with the same number of elements used for storing related information about a collection of data. Example:
FILE INPUT OUTPUT Skill Area 315 Part B Materials Prepared by
Quiz Next Monday.
Programming -2 برمجة -2 المحاضرة-5 Lecture-5.
Random Number Generation
DSP Lab. Week 7 CDMA and noise
File I/O.
More About File Reading
Starting Out with C++: From Control Structures through Objects
Pointers & Functions.
Programming with Data Files
Modular Programming with Functions
Code::Block vs Visual C++
Chapter 9 File Streams Computing Fundamentals with C++ 3rd Edition
Standard Input/Output Stream
File Processing in C++ Data is stored in files so that it may be retrieved for processing when needed.
Modular Programming with Functions
Formatted Input, Output & File Input, Output
DSP Lab. Week 12 DFT audio Doug Young Suh Media Lab. Rm401
CHAPTER 4 File Processing.
foo.h #ifndef _FOO #define _FOO template <class T> class foo{
Programming with Data Files
CMPE 152: Compiler Design March 26 – April 16 Labs
C++ Programming Lecture 8 File Processing
Pointers & Functions.
COMS 261 Computer Science I
COMS 261 Computer Science I
File I/O in C++ II.
Lecture 9 Files Handling
Introduction to Algorithms and Programming COMP151
File I/O in C++ I.
Text Files.
Presentation transcript:

DSP Lab. Week 1 Drawing sinusoidal waves Doug Young Suh Media Lab. Rm401 suh@khu.ac.kr Last update : September 8, 2015

MediaLab , Kyunghee University Sinusoidal wave   2018-11-21 MediaLab , Kyunghee University

MediaLab , Kyunghee University C-program #include <stdio.h> #include <conio.h> #include <math.h> main() { FILE *data = fopen("data.txt","w"); for(int i=0;i<1000;i++) fprintf(data,"%4d %10.2f\n",i,100.0+20.*sin(2.*3.14/100*(float)i)+40.*sin(2.*3.14/300*(float)i)); fclose(data); data = fopen("data440.txt","w"); for(i=0;i<4000;i++) fprintf(data,"%4d %10.2f\n",i,sin(2.*3.14*440.0/400000.*(float)i)); } 2018-11-21 MediaLab , Kyunghee University

MediaLab , Kyunghee University C++ program #include <iostream> //이 코드에서는 fstream만 사용하므로 iostream은 생략해도 됩니다. #include <fstream> #include <iomanip> #include <math.h> //math.h대신 cmath 써도 됩니다. using namespace std; int main() { ofstream outFile; outFile.open("data.txt", ios::out|ios::trunc); // ios::trunc로 덮어쓰기 파일 설정. for (int i = 0; i < 1000; i++) { outFile << i << " " << 100.0 + 20.*sin(2.*3.14 / 100 * (float)i) + 40.*sin(2.*3.14 / 300 * (float)i) << endl; } outFile.close(); outFile.open("data440.txt", ios::out|ios::trunc); for (int i = 0; i < 1000; i++) { outFile << i << " " << sin(2.*3.14*440.0 / 400000.*(float)i) << endl; } outFile.close(); return 0; } 2018-11-21 MediaLab , Kyunghee University

MediaLab , Kyunghee University Assignments   Send to suh@khu.ac.kr. 2018-11-21 MediaLab , Kyunghee University