Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi Experts,
I have one question about Mathcad 15 integrate function.
I want to calculate the area of the blue line, but I don't have any idea how to do it.
I have the data for the red curve. and I want to use this data to calculate equations (1) and Equation (2).
Could you please give me some suggestions on it, thanks.
Please see my attached file.
Solved! Go to Solution.
You have the data for the red trace (in the array C.oss ) , and want to calculate the (blue hatched) area underneath the curve.
With (only) this given, a fair approximation you can make for that area is:
under the assumption that the array C.oss contains only the values that correspond with Vds running from 0 to Vdc, this is equivalent to:
I see now that your C.oss is a matrix.
The area under the curve is approximated with:
Now your first integral would be:
The second:
under the assumption that the last value of the first column in C.oss actually holds Vdc.
Success!
Luc
Hi,
Try this.
Shows how to integrate a function.
Shows how to integrate if you have two column of data as j and H variables..
Hi,
You need to send the data file for the pulse:- EPC2045.txt
We can then use your data.
Cheers
Terry
With two possible simple integration methods:
And the spline interpolation suggested by Terry:
The area under your curve, assuming Vdc=100, becomes:
Your first integral would be:
The second:
Success!
Luc
Do you there are three ways that I can use to calculate the area?
1. integrate
2. Euler
3. spline interpolation
May I know what does first integral and second integral mean?
The integrate method simply adds the rectangles formed by a function value (y) and the distance between it and its predecessor on the x-axis.
Euler uses a somewhat more sophisticated approximation; it connects a straight line between the present and previous function-values instead of a horizontal line at the top of the rectangle.
'your first integral' is
Note that that is NOT the area under the curve...
'your second integral' is:
Success!
Luc
Spline interpolation is always done using cubics.
The difference between cspline, pspline and lspline concerns the treatment of the endpoints only (but can of course affect the whole interpolation curve).
@terryhendicott ,
Sorry, I don't very understand this method.
I have two variables in my equation
the left column is Vds, and the right column is Coss value.
When Vds = 0V, Coss = 1000F.
When Vds = 1.771V, Coss = 947.954F
I know the value of each column. How should I define the function?
Hi Jason,
Send the data file and I can show you. EPC2045.txt
Hi,
Here it is: You will need to reset the data filename.
Hi
The area under the curve which was the original question is:
Cheers
Thanks for your help.
it very help to me!
I can understand how to integrate.
Do you have any document about spline and interp function can provide to me?
Because I don't very understand what's the function of the spline and why you need to interpret the spline.
if I don't interpret the spline I can't do the integrate?
I am not sure that spline interpolation is that good an idea in case of the functions involved here.
I guess that simple linear interpolation would do the job at least equally well if not better because the splines often tend to overshooting/oscillating . probably not in case of your function as the points are quite close and regular.
I would use spline interpolation if i definitely know that it would be a suitable fit, otherwise a simple linear interpolation would have to suffice as everything else would add "details" which simply aren't there.
An linear interpolation means that we don't necessarily need to define an interpolating function (of course we could) but rather could resort to simple trapezoid integration:
Of course using a linear interpolating function the calculations may look more familiar:
EDIT: I added the units you had provided
You wrote "When Vds = 0V, Coss = 1000F." Is it sure Farad and not rather something like microFarad?
MC15 file attached
Hi Jason,
Just to answer all your questions:
Do you have any document about spline and interp function can provide to me?
cs=cspline(vx,vy).
vx is a column vector of the x values, vy is the column vector of the y values,
the cubic spline solution sets up a cubic function y=a.x^3 + b.x^2 +c.x + d for each interval between adjacent points.
it then solves for all the a,b,c,d values using the following constraints at the ends of each interval:
each cubic must pass through the end points.
the first derivative of adjacent cubics are equal at the meeting point
the second derivative of adjacent cubics are equal at the meeting point to give smooth curves either side off a point
the first and last equation can be cubic cspline(), a polynomial in second degree pspline() or simple linear equation lspline()
what is returned as cs is all the a,b,c,d's in a long column vector.
y=linterp(cs,vx,vy,x) allows you to use all the stored a,b,c & d in cs and choose the correct set.
it the uses the appropriate a,b,c &d equation for the x value entered and finds the value of y=a.x^3 + b.x^2 +c.x + d
Because I don't very understand what's the function of the spline and why you need to interpret the spline.
As above cs is just a list of a,b,c,d values. You need to use the interp function to determine which a,b,c,d to use for y=a.x^3 + b.x^2 +c.x + d at the point desired.
if I don't interpret the spline I can't do the integrate?
Werner and Luc have shown you can do it without using splines.
Above explanation explains why you need to use linter(cs,vx,vy,x) to get a y value at the right x for integration of a spline.
In this example cspline does a good job with no oscillations and the resulting integrations are close in value with whatever method you use.
Cheers
Terry
the first and last equation can be cubic cspline(), a polynomial in second degree pspline() or simple linear equation lspline()
Not exactly.
Actually the "equations", the polynomials used for interpolations, are not linear or quadratic in case of "lspline" or "pspline".
Its all about the second derivative of the interpolating cubics at the endpoints
E.g. using "lspline" results in what usually is called the "natural" spline and means, that at the end points the second derivative of the interpolating cubic should be zero. It does NOT mean that a linear function is used for interpolation at the end points!
Some further in-depths informations could be found in a document which used to be at the mathsoft site in former times (which I could not find an online source for now). As a replacement you may have a look at
https://www.researchgate.net/publication/236029592_Cubic_spline_interpolation_using_Mathcad
Thanks for your detailed explanation.
It is very clear to me.
As you said, I should use Microfarad, not Farad.