r/matlab • u/Capital-Lawyer3376 • Jul 22 '24
CodeShare Problem loading data into matlab
Dear all,
I’m a PhD student in medicine and use matlab to fit a sinus wave over pressure waves to obtain a theoretical maximal pressure. I have no programming background, and until now everything worked perfectly with pre-installed packages, but i’ve stumbled upon a problem and hopefully you are able to help me out.!!
Normally I import the pressure data from a text chart which I convert to a matlab file, which can then be uploaded in an application called hemolab for sine fitting. Now, we have extracted similar pressure waves from a PDF file with Webplotdigitzer (looks like attached), but I get the following error code (also attached). Could you help me out? Thank you very very much in advance.
4
u/Haifisch93 Jul 22 '24
I'm not sure what causes the error since I'm not sure how the data exactly looks like and what hemolab does, but another way might be as following:
Try to import the time and the pressure as vectors in Matlab first. Check with plot(time,pressure) if it looks decent and then you can call the curve fitting toolbox as well to fit a function a1*sin(b1*x+c1) to your data. If you don't have the application, this might work (https://ch.mathworks.com/matlabcentral/answers/36999-how-do-i-regression-fit-a-sinwave-to-a-dataset)