Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include ofApp.h int ofApp::getXSamples (float xMin, float xMax, float step, float x[]) { int i; int numSamples; numSamples = (xMax - xMin) / step +

#include "ofApp.h" int ofApp::getXSamples (float xMin, float xMax, float step, float x[]) { int i; int numSamples; numSamples = (xMax - xMin) / step + 1; for (i = 0; i

b = outMax - m * inMax;

out = m * in + b; return out; } void ofApp::map_vec (int n, float in[], float out[], float inMin, float inMax, float outMin, float outMax) { int i; for (i = 0; i

//-------------------------------------------------------------- void ofApp::setup() { float xSamples[N_MAX]; float xData[N_MAX]; int i; int k; int j; int isReading; FILE *fp; fp = fopen("/Users//Desktop//FrameWorks/OPF/apps/myApps/Assignement 4_b/bin/); isReading = 1; j = 0; while(isReading == 1) { k = fscanf(fp, "%f", &xData[j]); if (k == EOF) isReading = 0; else j++; } //printArray(j, xData, "Data values"); n = getXSamples(xMin, xMax, step, xSamples); // printArray(n, xSamples, "X values"); map_vec(n, xSamples, xPix, xMin, xMax, xPixMin, xPixMax); //printArray(n, xPix, "XPix"); map_vec(n, xData, yPix, yMin, yMax, yPixMin, yPixMax); //printArray(n, yPix, "YPix");

fclose(fp); }

//-------------------------------------------------------------- void ofApp::update() { }

//-------------------------------------------------------------- void ofApp::draw() { ofSetBackgroundColor(255, 255, 255); int i; for(i = 0; i

#include "ofMain.h"

#define N_MAX 500000

#define YSTEP 0.25

#define XSTEP 0.50

class ofApp : public ofBaseApp{

public:

//My Variables

float step = 0.1;

float xMin = 0.00;

float xMax = 500;

float yMin = 0;

float yMax = 350;

float xPixMin = 1000;

float xPixMax = 400;

float yPixMin = 600;

float yPixMax = 200;

int n; /umber of samples

float xPix[N_MAX];

float yPix[N_MAX];

//My Functions

int getXSamples (float xMin, float xMax, float step, float x[]);

void getDampedCosSample (int n, float x[], float y[], float alpha, float w);

float map (float in, float inMin, float inMax, float outMin, float outMax);

void map_vec (int n, float in[], float out[], float inMin, float inMax, float outMin, float outMax);

void printArray (int dim, float x[], char label[]);

//openframework functions

void setup();

void update();

void draw();

};

write an openframeworks program to plot the following function. after creating the plot input data into it and formulate whats in the second picture.Im having trouble using openframeworks I dont know if there is something wrong with my code, but i just want it fixed. the program must include all the functions. this is what the plots should look like. But instead of intel im doing ford stock from 2006-2012. image text in transcribedimage text in transcribed

The Damped sinusoid Function exp (-at) cos (wt) 1.00 a 0.50 w: 10.00 n.75 0.50 y (t) D.00 -0.50 n.75 1.00 0.0 0.5 1. 1.5 3.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 E.o E. 5 7.0 7.5 8.0 e s 9.0 9.5 uo.o time t

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

What is Working Capital ? Explain its types.

Answered: 1 week ago

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago