How to use imported data with trapz( )
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I have imported two columns of a csv data file into Matlab and are contained in one table. The columns are labeled Times and DragForceN. I want to use them in trapz(x,y). My end goal here is to obtain the work done by drag. I keep getting an error message and I cannot figure out how to fix it. Any help would be appreciated.
x = importdata('Times.csv');
y = importdata('DragForceN');
dragWork_H13 = trapz(x,y)
4 Kommentare
dpb
am 19 Sep. 2022
Well, the error says importdata couldn't open the file; you didn't even get to the second step...it didn't say it couldn't find the file; so apparently there is such a file but it wasn't a valid text file as the .csv extension would suggest it should be.
But, we can't tell what went wrong -- attach the file so somebody can try to duplicate the issue/see what the file really does contain.
Antworten (1)
KSSV
am 20 Sep. 2022
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1129920/H182%20Drag.csv') ;
x = T.(1) ;
y = T.(2) ;
% fill the NaN's in the data
x = fillmissing(x,'linear') ;
y = fillmissing(y,'linear') ;
%
trapz(x,y)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!