# Exam 3 - Phillip Thomas Exam 3 ME 218 UN:18085 PROBLEM 1 a...

This preview shows pages 1–4. Sign up to view the full content.

Phillip Thomas Exam 3 ME 218 UN:18085 PROBLEM 1 a) ) ( 0 / 1 / / / / 2 1 2 1 t v L z z I c I K L K L R z z t e + - - - = b) #include <stdio.h> #include <math.h> #define R 0.8 #define L 0.008 #define KT 0.045 #define KE 0.057 #define C 0.003 #define I 0.000082 #define V 10 double Kirchhoff( double z1_start, double z2_start, double inc); double Newton( double z1_start, double z2_start, double inc); int main ( void ) { double z1_0 = 0.0, z1, z2_0 = 0.0, z2, h = 0.001, t = 0.0, tf = 0.15; FILE *fp; fp = fopen("question1b_data.txt", "w"); printf(" t \t T \t w\n"); printf("%4.3lf\t%4.3lf\t%4.3lf\n", t, z1_0*KT, z2_0); fprintf(fp, "%4.3lf\t%4.3lf\t%4.3lf\n", t, z1_0*KT, z2_0); while (t < tf) { z1 = Kirchhoff(z1_0, z2_0, h); z2 = Newton(z1_0, z2_0, h); t += h; printf("%4.3lf\t%4.3lf\t%4.3lf\n", t, z1*KT, z2); fprintf(fp, "%4.3lf\t%4.3lf\t%4.3lf\n", t, z1*KT, z2); z1_0 = z1; z2_0 = z2; } fclose(fp); return 0; } double Kirchhoff( double z1_start, double z2_start, double inc) { double z1_new = z1_start + inc*((-R/L)*z1_start + (-KE/L)*z2_start + V/ L); return z1_new; } double Newton( double z1_start, double z2_start, double inc) { double z2_new = z2_start + inc*((KT/I)*z1_start + (-C/I)*z2_start); return z2_new; }

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Phillip Thomas Exam 3 ME 218 UN:18085 Torque vs Time Angular Velocity vs Time c) #include <stdio.h> #include <math.h> #define R 0.8 #define L 0.008 #define KT 0.045 #define KE 0.057 Time Tim Torque Angula r
Phillip Thomas Exam 3 ME 218 UN:18085 #define C 0.003 #define I 0.000082 double Kirchhoff( double z1_start, double z2_start, double inc, double time); double Newton( double z1_start, double z2_start, double inc); double Voltage( double time); int main ( void ) { double z1_0 = 0.0, z1, z2_0 = 0.0, z2, h = 0.001, t = 0.0, tf = 1.5, v0 = 0, v; FILE *fp; fp = fopen("question1c_data.txt", "w"); printf(" t \t T \t w \t V(t)\n"); printf("%4.3lf\t%4.3lf\t%4.3lf\t%4.3lf\n", t, z1_0*KT, z2_0, v0); fprintf(fp, "%4.3lf\t%4.3lf\t%4.3lf\t%4.3lf\n", t, z1_0*KT, z2_0, v0); while (t < tf) { z1 = Kirchhoff(z1_0, z2_0, h, t); z2 = Newton(z1_0, z2_0, h); v = Voltage(t); t += h; printf("%4.3lf\t%4.3lf\t%4.3lf\t%4.3lf\n", t, z1*KT, z2, v); fprintf(fp, "%4.3lf\t%4.3lf\t%4.3lf\t%4.3lf\n", t, z1*KT, z2, v); z1_0 = z1; z2_0 = z2; } fclose(fp); return 0; } double Kirchhoff( double z1_start, double z2_start, double inc, double time) { double z1_new; if (time < 0.1) z1_new = z1_start + inc*((-R/L)*z1_start + (-KE/L)*z2_start + (100*time)/L); else if (time < 0.4)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 06/23/2011 for the course ME 218 taught by Professor Unknown during the Fall '08 term at University of Texas.

### Page1 / 15

Exam 3 - Phillip Thomas Exam 3 ME 218 UN:18085 PROBLEM 1 a...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online