You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
How to find a surface area for any plotted wave
1 view (last 30 days)
Show older comments
Accepted Answer
Paulo Silva
on 10 Mar 2011
doc trapz
doc cumtrapz
22 Comments
Paulo Silva
on 10 Mar 2011
You have the sampling frequency (Fs) of the wav, time values (X) and amplitude of the wav (Y), you just need to calculate:
trapz(X,Y)/Fs
santosh
on 10 Mar 2011
thanks for ur prompt reply paulo,
I dont have sampling frequency for each wave, I just have time and amplitude. Is it possible to get without the frequency or if no, then pls help me out to find the sampling frequency for each wave I choose.
Paulo Silva
on 10 Mar 2011
Fs=1/(t(ind+1)-t(ind))
santosh
on 10 Mar 2011
thnx paulo
I used the above function but it is showing me the error as
??? Error using ==> mrdivide
Matrix dimensions must agree.
Error in ==> trialdiff45matrix at 216
Z = cumtrapz(t(record2),1)/Fs;
Here is the figure code which i m using to plot and i trying to find the surface area of that wave, I used the matrices to plot this wave may be this is causing me the error. Pls have a look on this code
figure(7);
plot(t,Z2,t(record2),Z2(record2),'r*');
title('Averaged desired points found through Absolute Difference matrix');
Fs=1/(t(record2+1)-t(record2))
Z = trapz(t(record2),Z2(record2))/Fs
Paulo Silva
on 11 Mar 2011
insert a . before / so the operations can be done element by element, I'm not sure about what your are doing. Fs should be a single value not a vector but with luck it could work.
Paulo Silva
on 11 Mar 2011
Just in case you got different Fs values in a time vector (t) and you want to know the values do this:
unique(1./diff(t))
Paulo Silva
on 11 Mar 2011
I'm very sorry but I just can't help everyone that sends me emails, everyday someone sends their homework to my email but I have my own important things to do and the time spent here is already too much, it's better for you to put your questions and doubts here for all to see!
santosh
on 11 Mar 2011
hello,
sorry for the mail.
I have large number of input files which consists of data in CSV format. Each data file has about 600 rows and 2 columns. So i want to find the surface area under the curve for each file after plotting. can u plz help me out.
Paulo Silva
on 11 Mar 2011
The way I told you to calculate Fs, does it return one value of Fs for a given file data?
Paulo Silva
on 11 Mar 2011
are the values very similar, if so average them and use that value for Fs
Paulo Silva
on 11 Mar 2011
that means that all measurements used the same Fs don't you agree?
santosh
on 11 Mar 2011
No all the measurments have variations even the surface area calculation:
Fs=1/(t(record2+1)-t(record2));
Q= mean(Fs);
Z = trapz(t(record2),Z2(record2))/Q;
for above variables the values are same for different measurments.
Paulo Silva
on 11 Mar 2011
what's record2?
Paulo Silva
on 11 Mar 2011
Try with cumtrapz
Fs=1/(t(record2+1)-t(record2));
Q= mean(Fs);
Z = cumtrapz(t(record2),Z2(record2))/Q;
Paulo Silva
on 11 Mar 2011
there's something wrong with your code, please check it, it's too late here, must go sleep a bit, good luck finding the error, bye
More Answers (0)
See Also
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)