FAI756843 All American 908 Posts user info edit post |
for Diff Eq.
Want to knock this out in one day. Willing to pay 12/hour for someone who knows what to do and can fully explain and help me with this.
Im new to MatLab, so someone with MatLab expertise and in depth knowledge of Diff Eq's would be great
12/hour. 12/3/2007 2:39:26 AM |
NC86 All American 9134 Posts user info edit post |
matlab sucks
[Edited on December 3, 2007 at 4:04 AM. Reason : x] 12/3/2007 4:03:57 AM |
darkone (\/) (;,,,;) (\/) 11610 Posts user info edit post |
MATLAB rocks. I think I use it almost everyday.
I think you can find this exact problem in MATLAB's help/demo files. 12/3/2007 8:44:44 AM |
FAI756843 All American 908 Posts user info edit post |
its not in the demo files.
I need tutoring/help with this. Not only with the matlab aspect but also the Diff Eq part too. 12/3/2007 11:23:12 AM |
Wraith All American 27257 Posts user info edit post |
MATLAB is very useful if you know how to use it. It has a rather steep learning curve if you are just thrown into the fray though. 12/3/2007 12:21:49 PM |
darkone (\/) (;,,,;) (\/) 11610 Posts user info edit post |
Look at ode23 in the help files.
You have to write a 4 line function using the script editor to define the function that you'll need to use for the ode23 command.
Your script file will look something like this:
function functionname(t,y) %variables t and y dy=zeros(2,1); %establish a zero filled array to stick things into dy(1) = y(2); dy(2) = 'whatever you worksheet calls for' (e.g.: (1/2)*y(1) + y(2)) [figure this out for yourself];
note the help files for the input requirements for ode23 and how you input your initial values
you'll input something like this into the command line:
[T,Y] = ode12(@functionname,[0 25],[2 0]);
A simple plot to see you solutions:
plot(T,Y(:,1),'-',T,Y(:,2),'-.');
This should be enough to get you started.12/3/2007 3:23:37 PM |
FAI756843 All American 908 Posts user info edit post |
i understand the matlab stuff... as far as graphing it.
But the second part is where im at a loss. I know i have to set up a matrix to solve this ode, but im not quite sure if im doing it right or not. 12/3/2007 3:48:44 PM |
darkone (\/) (;,,,;) (\/) 11610 Posts user info edit post |
^ We can't help you with that due to you not having given us the second page of the assignment. 12/3/2007 4:55:47 PM |
LimpyNuts All American 16859 Posts user info edit post |
^ bullshit. the second page says how to generate the random data for least squares. least squares is pretty damn simple.
q = Invert( Transpose(X) * W * X ) * Transpose(X) * W * Y
Since it doesn't look like you're using weighted least squares, the weight matrix is the identity matrix and you have:
q = Invert( Transpose(X) * X ) * Transpose(X) * Y
The matrix X is your independent variables (the things you want the coefficients to). Each row corresponds to a data point and each column to term in the function definition. Y is a vector containing the response (dependent variable) for each data point.
Rewrite the equation:
y = -m/k * d2y/dt2 - c/k * dy/dt
Your random data will be of the form: y(t) = #
Your independent variables for least squares are d2y/dt2 and dy/dt.
1. Use a finite difference formula to calculate the first and second derivatives of a discrete data set. 2. Populate a matrix X. X should have 2 columns and a row for every data point used in the analysis (using finite differences, you won't have derivative values for the first or last data points, so these won't have corresponding rows). The first column of X should contain values of d2y/dt2 and the second column should contain values of dy/dt. 3. Create a vector Y containing the values of y(t) at each data point with derivatives. 4. Evaluate q = Invert( Transpose(X) * X ) * Transpose(X) * Y -- (I don't know MATLAB code sorry) 5. The first element of the q vector will be the coefficient of the first independent variable column in X (that corresponsing to d2y/dt2), or -m/k. The other value will be -c/k.
From the initial conditions:
-(-m/k) * d2y(0)/d2t + (c/k)*0 + 2 * k = 0
The second derivative at 0 is obtained from a finite difference approximation and m/k is known, so k can be determined. With k, you can get m and c. Notice you never have to solve the differential equation to do this part.
6. Pay me $12 7. Profit
I know how to do the first part as well, but again I don't know any MATLAB, just math. 12/4/2007 2:21:41 AM |
FAI756843 All American 908 Posts user info edit post |
^ wanna meet up so you can help me through this ? 12/4/2007 9:47:45 AM |
Walter All American 7760 Posts user info edit post |
drop out of whatever major you're in right now
he just told you how to do it 12/4/2007 9:51:14 AM |
LimpyNuts All American 16859 Posts user info edit post |
^^ Maybe you didn't read my post. Let me reiterate the highlights:
0. Read this whole post before responding. 1. I do not know any matlab. 2. I do know how to do least squares and numerically solve ODEs and PDEs. 3. Above is a step by step on exactly how to perform least squares on YOUR problem. All YOU need to do is figure out how to generate random data and use it to fill your matrices in MATLAB, then perform 3 different matrix operations to get your parameters. Once again, I haven't used MATLAB in years, so I can't help you with that, except to say that I think you transpose a matrix with a single quote like this: X' (that would return the transpose of X).
Obviously you're desperate to get this problem done because you're offering someone $12/hr to help you do it and you haven't the foggiest notion how. If I weren't so busy this week I'd help you through it, but I guarantee you it will end up costing you between $50 and $100 for someone to get you through this. If it is really worth that much to you, then give me a call (910 431 6654) and I'll meet you on campus in a couple hours.
I have some old MATLAB work including an implementation of the conjugate gradient method (another type of matrix optimization problem) that should have enough information to complete the second part. I can more than likely figure out the first part using the help files. 12/4/2007 4:19:27 PM |