Search results

  1. F

    Engineering Modelling a DC Motor

    This is not homework but I would consider it to fall in this category. I am working on a robotics project and wanted to simulate a PID controller before implementation. I need to find a transfer function for my motor for this to work. Homework Statement As mentioned above, I need to find...
  2. F

    FFT in MATLAB help

    Homework Statement Find the Fourier Transform of a unity amplitude rectangular pulse of width 2T, where T=[ims]. Use MATLAB to plot the magnitude response of this signal's FT. Homework Equations The Attempt at a Solution I got something that LOOKS right, but the first...
  3. F

    C/C++ Sudoku Solver in C++

    Yeah, I had actually thought about using recursion and may still do so. It's been a few years since I had any formal programming class (an Intro to C class my freshman year of college) so I'd just need to read some stuff to refresh my memory. Seems like the safest route to go. I actually...
  4. F

    C/C++ Sudoku Solver in C++

    Hey everyone, I'm trying to teach myself C++ and I recalled that a few years ago my Comp Sci major buddy of mine did a sudoku solving program as a project for a class so I decided to tackle it on my own. I'm getting some headway, but I'm having trouble figuring out a way to "brute force"...
  5. F

    Determine where a complex function is analytic

    Homework Statement Determine the region of analyticity of ln|z| + i*arg(z) and justify your answer. Homework Equations The Attempt at a Solution I said that if z=x+iy, the function has a singularity when both x and y are equal to 0 since ln(0) is undefined and arg(z) = arg(x+iy) =...
  6. F

    Gauss' Law, Spherical Charge Distribution

    Before I get into the question I'd just like to state that this is not homework, but questions in my book that I'm going through to prepare myself for the midterm in one week. I got stuck at a few questions, here's the first one. I won't ask the next until I'm done with this and so forth...
  7. F

    Cockroft Walton Voltage Multiplier Problems

    Hey everyone. So I like to have electronics projects going on to keep me on my toes during the academic year and my project I chose for fall ended up being a Cockroft Walton Generator. Basically, I was just looking to make a simple negative ion generator from it. I finally got the parts in...
  8. F

    Curl of a vector field

    Yeahh... It's late (3am here) and I have an 8am class not to mention I've been doing other homework on top of this. I'm really sorry that it's tough for me to type correctly, I should've double checked that second one I posted (or, even better, been more clear in my opening post). The last one...
  9. F

    Curl of a vector field

    Yeah, I see that I didn't take that into account. There I'm using x=2 since the line goes from (2,2) down to (2,1) and so x is constant at 2. Why not though? If the triangle has a line going from (1,1) to (2,1); (2,1) to (2,2) and (1,1) to (2,2) which is the hypotenuse, how is the point...
  10. F

    Curl of a vector field

    I re-did part a based on your recommendation (though I didn't see any benefit in parameterizing the curve, am I missing something?) Here's what I got: Integral I worked off of: \int 3x^{2}y^{2}dx - \int x^{3}y^{2}dy Leg 1 (from (1,1) to (2,1)) \int_{1}^{2}3x^{2}dx = 7 Leg 2 (from (1,1) to...
  11. F

    Curl of a vector field

    Yeah, clockwise. And I have limits from 1 to 2 on both (I should've specified that the triangle legs go from (1,1) to (1,2) and (1,1) to (2,1). Sorry 'bout that. Now my integral I have for part b is \int_{1}^{2} \int_{1}^{2} (-3x^{2}y^{2} - 6x^{2}y)dxdy I'm assuming this is incorrect as...
  12. F

    Curl of a vector field

    Yeah, I tried doing everything in Latex but it was giving me errors were there shouldn't have been. It was very odd. As for that 2 and 3 thing- the 2 is a typo. The correct equation is A = ax(3x^2y^2) - ay(x^3y^2), my apologies. In part A- that's what I wasn't sure about. I wasn't sure if I...
  13. F

    Curl of a vector field

    I done screwed up. Part b the cross product I did was wrong, stupid mistake. It should be the double integral of -3x^2y^2-6x^2y dxdy from 1 to 2 on both integrals which equals -112/3
  14. F

    Curl of a vector field

    Homework Statement Assume the vector function A = ax(3x^{2}2y^{2})-ax(x^{3}y^{2}) a) Find \ointA\cdotdl around the triangular contour shown in Fig. 2-36 [it is a triangle with base and height of one on the x and y axis. the curl travels so that the normal vector is in the -z direction] b)...
  15. F

    Insulating bare wire

    Hey guys, I'm working on a little project and I need to build an inductor. Now the problem is I have bare copper wire (like, a ton of it) and was hoping there was a way that I could insulate it so I could use it like typical magnet wire? Is it possible for me to just use a spray-enamel? I...
  16. F

    Optimization of C code: smoothing an image.

    Thank you mark, that is very clear! Now if I wanted to define a pointer to, say, the first column of src (assuming the first dimension is a row and the second is a column) would I say something like pixel *pointer = src[][0];? Or would I even have to do that? Could I just use src[][0]? Or...
  17. F

    Optimization of C code: smoothing an image.

    When I do that I still get error: array type has incomplete element type I tried putting dim in the array while leaving off the 'struct' part and still get the error. EDIT- I got an email from my prof saying I can't change the structure of smooth so the variables have to be as follows: void...
  18. F

    Optimization of C code: smoothing an image.

    So I started from scratch and rethought the whole process and thought I had something that would work well but I'm confused on a few things. 1) I'm getting weird compiler errors that I can't seem to fix 2) It still runs, but the speed up is only 1.2 and it should be much higher (I think)...
  19. F

    Optimization of C code: smoothing an image.

    It might be worth mentioning, I'm an Electrical Engineering major and this is an Electrical Engineering class. This class is a basic class to understand the point where software meets hardware (but we focus more on the software side. Computer Architecture focuses on hardware). That may...
  20. F

    Optimization of C code: smoothing an image.

    Ok, gotcha, thanks! I stumbled across this code which runs 4.3x faster (though I don't want to use it because 1) that's cheating and 2) I've put in so much work already that I don't want it all to be for nothing): static inline void add_pixel_2(pixel_sum *sum, pixel *a, pixel *b) {...
  21. F

    Optimization of C code: smoothing an image.

    Wow, can't believe I missed that! Thanks, it runs now! Only an average speed up of 1.2x though and I need 3.5x. Now what's this inline thing? I've never used it and certainly do not recall learning it in class. Does it align values in the cache or something?
  22. F

    Optimization of C code: smoothing an image.

    I'm not entirely sure what an edge effect error is, but if I were to wager a guess I'd say it has to do with the pixels on the edges of the picture getting skewed because it's trying to smooth them in with pixels that don't exist (outside the picture)? What steps could I take to fix that...
  23. F

    Optimization of C code: smoothing an image.

    ERROR: Dimension=96, 282 errors E.g., You have dst[95][93].{red,green,blue} = {28763,43398,44112} It should be dst[95][93].{red,green,blue} = {23151,37441,41242} Benchmark "smooth() function" failed correctness check for dimension 96. We're using a makefile that runs through the...
  24. F

    Optimization of C code: smoothing an image.

    Cool, thanks Mark! I figured out why I was getting those errors and I now have fixed them. However, now when I run the code I get an error when dim=96. Obviously there is something wrong with my code so I'll start walking through it to make sure it's doing the same thing as naive_smooth. If...
  25. F

    Optimization of C code: smoothing an image.

    Honestly, that was just me trying to get rid of the error. My original code had sum = ∑ There is no good reason I recast it, but I figured it was worth a shot :rolleyes: Also, I talked to my professor briefly and he pointed out that there were a lot of areas where i was confusing...
  26. F

    Optimization of C code: smoothing an image.

    Homework Statement I need to optimize this given code: /* A struct used to compute averaged pixel value */ typedef struct { int red; int green; int blue; int num; } pixel_sum; /* Compute min and max of two integers, respectively */ static int min(int a, int b) { return (a < b ...
  27. F

    Transfer Functions

    Homework Statement Determine the transfer function for the circuit shown in figure 5 if the output voltage is defined as the voltage drop across the 20\Omega resistor. Note there are two sources in this circuit. Homework Equations H(s) = \frac{Vo}{Vi} The Attempt at a Solution...
  28. F

    Voltage drop and current for each resistor

    So the members here don't do your homework
  29. F

    Voltage drop and current for each resistor

    Err, fallen186, you may want to read https://www.physicsforums.com/showthread.php?t=5374" over real quick. Specifically this line:
  30. F

    Voltage drop and current for each resistor

    Ok, so you now have two resistors in the circuit- you can calculate the voltage drop across each resistor and, using Ohm's law, the current. You need to be a little more specific with what you're looking for so you can get more help.
  31. F

    Equivalent Resistance Problem

    Yes, it has zero resistance (the diamond) but I don't want to say more lest I give away the answer. Think about when a source is applied, where is current going to flow? This is a very common type of problem for intro courses to electronics. It's basically designed to force the student to...
  32. F

    Equivalent Resistance Problem

    My approach would be to redraw the circuit so it's a bit easier to see what's going on. You are right that mesh and nodal don't apply- you have no need to find voltages or currents. Now, lastly, why do you say the top left are in parallel and the rest are in series? Step through that...
  33. F

    Optimization of C Code Loop Unrolling

    Hey, sorry I haven't responded back I've been busy with other coursework. Anyways, I checked and RIDX is not in my file at all- I assume it's defined elsewhere, but I don't know what file (there are a ton- we don't need to go into any of them says my prof). As for pointer arithmetic- I don't...
  34. F

    Optimization of C Code Loop Unrolling

    Ok, well I got the unrolling to work (I should not have been touching j since I wasn't incrementing it by 4) but the best I could get it to do was when I incremented i by 16 and my performance was exactly the same as the naive_rotate code. I'm thinking I need to have a few separate loops that...
  35. F

    Optimization of C Code Loop Unrolling

    Will do. And this isn't due for two weeks so time is not of the essence here- I just want to work on it when I have some free time. Thanks for everything so far!
  36. F

    Optimization of C Code Loop Unrolling

    Optimize naive_rotate and naive_smooth although I only posted rotate because I just want to get through this one first. No idea what a profiler is at all... Yeah, I meant my first loop, my bad. dim, as I said, is only equal to multiples of 32 so dim is never equal to anything less than 32...
  37. F

    Optimization of C Code Loop Unrolling

    The way I understand the lab it seems like we should just be re-writing naive_rotate, but I didn't think of looking at the rest of the program. What's the best way to look at what's going the slowest? Compiling it and looking at the assembly seems like it would be the best option, yes? Yeah...
  38. F

    Optimization of C Code Loop Unrolling

    Homework Statement I need to optimize this given code that rotates an image 90 degrees so it runs at least three times faster: void naive_rotate(int dim, pixel *src, pixel *dst) { int i, j; for (i = 0; i < dim; i++) for (j = 0; j < dim; j++) dst[RIDX(dim-1-j, i, dim)] =...
  39. F

    Impedance calculation?

    Well Impedence for each element is given by the equations that xcvxcvvc gave except with one little adjustment: Z_L=j\omega L Z_C=\frac{1}{j\omega C} (The ones he gave were reactance) \omega is the angular frequency which can be calculated by setting it equal to 2\pi f From there you...
  40. F

    Assembly level debugging problem

    Ok, I agree with you on what is going on there. So, does that mean the following is correct? 1: Assume value for ebp. I say 0 just to make everything easier. 2: esp = ebp = 0 3: eax = 8 4: ecx = 12 5: address of eax is 40 (4*eax + eax) 6: eax = 56 7: edx = 196 8: edx = 208 (196 +...
  41. F

    Assembly level debugging problem

    Ok, you can just assume a value for epb. That's what I thought, but I never read it anywhere so I wasn't sure. Well I know the way mov statements work is that it is structured Soruce,Destination so that means the value of 0xb8 + the value stored in the register at %ecx is stored into the...
  42. F

    Assembly level debugging problem

    How would I go about finding the value of ebp though (without using, say, info registers in gdb)? I guess that's where I'm stuck. I can figure out what the body of the function is doing, it just takes a bit of thought, but the beginning values are what confuses me. With regard to this...
  43. F

    Assembly level debugging problem

    Homework Statement (This is x86 Assembly Language.) You are charged with maintaining a large C program, and you come across the following code: typedef struct{ int left; a_struct a[CNT]; int right; } b_struct; void test(int i, b_struct *bp) { int n = bp->left + bp->right...
  44. F

    Determine Posititive Feedback Gain in an Oscillator

    NOTE- Images are thumbnails, click to enlarge Homework Statement Show that the positive feedback gain expression for the circuit below is v2/v0 = 1/[3 + j(wL/R - R/WL)] (anything in red I added to the original problem) Homework Equations (above) The Attempt at a Solution Along with the...
  45. F

    Energy of resulting Gamma Rays after particle annihilation

    Homework Statement An electron and a positron are moving side by side in the +x direction at 0.50c when they annihilate each other creating two gamma rays. What is the energy of each photon? Homework Equations (mc2 + K+) + (mc2 + K-) = E1 + E2 The Attempt at a Solution I solved...
  46. F

    Circuit with two terminals

    Yep that's right. Also, if you want to verify your answer you could do a Voltage divider equation... V = 10V * (3 / (3+2) ) = 6 or KCL analysis at that top node so (V1 - 10V)/2 + (V1 - 0)/3 = 0 and then solve for V1 which ends up being 6V. Of course the way you did it is the easier...
  47. F

    Physics of Waves & Sounds

    The formula needed is F = F' * (V +/- Vd)/(V +/- Vs) where F is the frequency observed, F' is the frequency emitted, V is the speed of sound, Vd is the speed of the detector and Vs is the speed of the source. You have to determine the signs based on your knowledge of how sound works.
  48. F

    Circuit with two terminals

    That's incorrect. The 1 Ohm resistor is just a wire as there is no current flowing through it so it can be ignored. So now you basically just have that first loop. The voltage across terminals A and B is the same as the voltage across the 3 Ohm resistor, right? How can you find the voltage...
  49. F

    Engineering RC Circuit rise time

    I may have figured it out, I simulated it in PSpice and worked around with a few new ideas and these numbers seemed to match up... Vt/vo = 1 - exp(-t/RC) The ratio of Vt/vo is the percentage of the final state so for 90% of the final it would be .9 .9 = 1 - exp(-t/RC) -.1 = -exp(-t/RC) .1 =...
Top