[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 113 KB, 1280x800, interpolate.png [View same] [iqdb] [saucenao] [google]
4469740 No.4469740 [Reply] [Original]

Hi /sci/ I need some help with my numerical analysis class. We have a project with 7 problems but there's one I don't have any idea how to do.

[Raised Cosine Interpolation] Interpolate
f(x) = 1/(1+x^2)
at evenly spaced points on the interval [−5, 5] using a raised cosine basis function and n=5 points, n=10, n=20. Does the approximation get better with more points?

Basically we have to use matlab to solve the problem. The raised cosine is (cos(x) + 1)/2.
Pic related is all I've got so far.

>> No.4469763 [DELETED] 

lol matlab
lol windows
lol homework

>> No.4469784

>>4469763
thanks asshat

>> No.4469790 [DELETED] 

>>4469784
No problem.

You can let the thread die and do your homework alone now.

>> No.4469796
File: 15 KB, 460x276, 1331135350498.jpg [View same] [iqdb] [saucenao] [google]
4469796

>>4469790
this guy is actually an a.i. program. I don't think it's possible to be on a website 20 hours a day.

>> No.4469799

>>4469796
good to know

>> No.4469809 [DELETED] 

>>4469796
Come on, faggot. Do the turing test.

>> No.4469835 [DELETED] 

>>4469763
Yes matlab
I have a dual boot and I'm not running matlab on windows
Yes I'm doing homework and I just need a bit of help, anything is appreciated.

>> No.4469865

You'll discover something interesting in this well known example. Solving the problem yourself is strongly recommended.

>> No.4469882

>>4469809
With only 1 candidate?
Turing test is with both chatbots and real persons, and the test persons have to pick the bots out. Kinda hard with only 1 person/bot?

>> No.4469884

>>4469865
ok maybe I should elaborate on my problem. I know that there is a thing called the vandermonde matrix. The problem is that I don't think that I can use a vandermonde matrix or any method I already used for polynomial interpolation, local linear interpolation, or lagrange polynomial interpolation. I'm just stuck, I just need somewhere to look to point me in the correct direction, google isn't helping because it keeps telling me about fourier transforms and filters, which isn't what I want.

>> No.4469887 [DELETED] 

>>4469882
don't you know turing test? you don't need bot and human. one of them is enough to decide what he is.

>> No.4469910

Is this what you're looking for?

http://pastebin.com/AGL923qi

>> No.4469913

>>4469884

Yep, Vandermonde Matrix is a buzzword. And you want to interpolate, i.e. find an expansion into a set(!) of basis functions (cosines [raised or not] are orthogonal and complete). You can write that in terms of a linear system of equations. Expansion coefficients are the unknown Vector, the sampling points are the right hand side. And the matrix is the matrix... Formulate the problem with pencil and paper first.

>> No.4469939

>>4469910
whoa can you explain how you did that, did you write that or find it?

>>4469913
ok here's the problem. We've learned absolutely nothing about this in class. I took linear algebra with the same teacher and learned fucking nothing. I kind of see what you're saying here's what I have:
A = [ m0, m1, m2 ..., mn], m's are row vectors
I(f) = sum(f(xk) * mk(x), I is the interpolating function
I(f) = A( f(x0); f(x1); f(x2) )

I just have no idea how to turn that into a matlab function.

>> No.4469989

>>4469939
Of course Matlab has a function to solve your problem in a single line ;-) But i think you're supposed to do it the hard way (and learn how matlab does it). Suppose you have a finite set of functions f(k,x) with an integer index k numbering your functions. Say we want to find the interpolation of three of them which go through three points (x_i,y_i) i \in [1,3]. Then, we have the equations (c_k are the unkown coefficients):

y_1=c_1*f(1,x_1)+c_2*f(2,x_1)+c_3*f(3,x_1);
y_2=c_1*f(1,x_2)+c_2*f(2,x_2)+c_3*f(3,x_2);
y_3=c_1*f(1,x_3)+c_2*f(2,x_3)+c_3*f(3,x_3);

See the Vandermonde matrix?

>> No.4470076

>>4469910
that's a linear interpolation of a cosine function actually, I need an interpolation using cosine of the equation above.

>>4469989
what do the 1, 2, and 3, stand for in the front. What are my f's? I only have one function, the raised cosine, so how can I have multiple functions?

>> No.4470096

>>4469740
1,2,3 at the xs and the ys are the indices of your interpolation points. The set of functions you want looks like 1/2*cos(2*pi*k/d*x)+1/2 where d is some characteristic length.

>> No.4470102

>>4470096
Oh I get it now, thank you very much.

>> No.4470103

>The raised cosine is (cos(x) + 1)/2.

Isn't raised cosine: [Cos( pi*alpha/T ) / (1-(2*alpha*t/T)^2 ]sinc(t/T) ?

>> No.4470122

The good new is: f(k,x) can be any function you like and the interpolation still works in principle (i.e. the function goes through each sampling point exactly). Unless the generalized Vandermondian doesn't have linear dependent colums or rows you'll get a good result. If the system is overestimated (more functions than sampling points) you'll have to be more careful.

>> No.4470127

>>4470122
more sampling points than functions, of couse. Otherwise you won't get a result anyway.

>> No.4470135

>>4470103
not what I was told in class but that's probably the one electrical engineers use for filters and stuff.

In my case I need a function that's 1 in the middle and 0 on both endpoints. It also helps that it's derivative is 0 at the endpoints.