How to create a hysteresis loop
178 ビュー (過去 30 日間)
古いコメントを表示
I am very new to coding and I want to understand how to generate a hysteresis loop for blood vessels. This work was done in mice but the ones I see on MatLab answer primarily have to do with magnetism and I am unsure how to tailor my data to fit the different equations/codes.
Below is the code I wrote which essentially plots my data set but it does not generate a loop per se.
lumenWT = (Old.WT_2283)
pressureWT = (Old.Pressure);
x = floor(length(lumenWT)/2);
x1 = lumenWT(1:x);
x2 = lumenWT(x:end);
y1 = pressureWT(1:x);
y2 = pressureWT(x:end);
figure
L1 = plot(y1,x1,'-k',LineWidth=2);
hold on
L2 = plot(y2,x2,'-k',LineWidth=2);
legend([L1 L2 L3 L4], ...
'WT Loading','WT Unloading','Location','southeast');
ylabel('Lumen diameter (microns)')
xlabel('Pressure(mmHg)')
title("Old")
grid on
An answer from a few years ago generate this script which is what I am hoping to recreate but I have not been successful. :
X = [-3:.2:3 3:-.2:-3];
Y = [tanh(X(1:length(X)/2)-1) tanh(X(length(X)/2+1:end)+1)];
patch(X,Y,[.5 1 .5]); hold on
quiver(X(1:end-1),Y(1:end-1),diff(X),diff(Y),0);
I am kindly asking for some suggestions or some direction
7 件のコメント
William Rose
2023 年 1 月 3 日
It has stress (σ) on the vertical axis and strain (λ) on the horizontal axis. To estimate stress and strain from pressure-diameter data:
Strain: or
Stress:
where is the diameter with zero stress, is the change in diameter from ( = circumferential length, is the change in circumferential length from ), P is the pressure in the vessel, and w is the wall thickness. The equation for σ is a consequence of Laplace's law for wall tension in a cylindrical vessel.
Since you have an initial diameter of zero, the strain computed with the equation above is infinite. You could estimate circumferential length as 2*width of the flattened vessel when pressure is <=20, and L=pi*diameter when the cross section is ciruclar. Then you could use the second strain equation above.
Since you have not reported or estimated the wall thickness, we cannot calculate the stress. Wall thickness will tend to vary roughly inversely with circumferential length, since wall tissue volume is approximately constant.
Since you did not report the data needed to compute stress or strain, a plot of pressure versus diameter may be a reasonable substitute. The P-d plot and the stress-strain plot will both exhibit hysteresis, if it exists.
回答 (2 件)
Sulaymon Eshkabilov
2023 年 1 月 3 日
編集済み: Sulaymon Eshkabilov
2023 年 1 月 3 日
clearvars
Old = readtable('Old.xlsx');
lumenWT = (Old.WT_2283) ;
pressureWT = (Old.Pressure);
x = floor(length(lumenWT)/2);
x1 = lumenWT(1:x);
x2 = lumenWT(x:end);
y1 = pressureWT(1:x);
y2 = pressureWT(x:end);
x2 = rmmissing(x2);
y2 = rmmissing(y2);
figure(1)
L1 = plot(y1,x1,'-k','LineWidth', 2);
hold on
L2 = plot(y2,x2,'-k','LineWidth',2);
legend([L1 L2], ...
'WT Loading','WT Unloading','Location','southeast');
ylabel('Lumen diameter (microns)')
xlabel('Pressure(mmHg)')
title("Old")
grid on
X = [x1; x2; -1*x1; -1*x2];
Y= [y1; y2; -1*y1; -1*y2];
patch(Y,X,[.5 1 .5]); hold on
quiver(Y(1:end-1),X(1:end-1),diff(Y),diff(X),0);
William Rose
2023 年 1 月 3 日
[I moved my code to the "Answer" section, which is where I should have posted it initially.]
I relaize that you have raised and then lowered the pressure inside a blood vessel. YOu have measured the diameter as a funciton of pressure. You did the experiment in three specimens.
There is one rows on NaNs in the data, which we will remove.
Here is code to plot the pressure-diameter loops.
data=xlsread('Old.xlsx');
pres=data(:,1); %column 1 = pressure
diam=data(:,2:end); %columns 2-4=diameter
[~,cols]=size(diam);
pres=pres(~isnan(pres)); %remove rows with NaN
diam=diam(~isnan(diam)); %remove rows with NaN
diam=reshape(diam,[],cols); %reshape diam to have 3 columns
[rows,~]=size(diam);
rm=rows/2; %middle row number
figure;
plot(pres(1:rm),diam(1:rm,1),'-r','linewidth',2); hold on
plot(pres(rm+1:end),diam(rm+1:end,1),'--r','linewidth',2); hold on
plot(pres(1:rm),diam(1:rm,2),'-g','linewidth',2); hold on
plot(pres(rm+1:end),diam(rm+1:end,2),'--g','linewidth',2); hold on
plot(pres(1:rm),diam(1:rm,3),'-b','linewidth',2); hold on
plot(pres(rm+1:end),diam(rm+1:end,3),'--b','linewidth',2);
xlabel('Pressure (mmHg'); ylabel('Diameter (\mum)');
grid on; title('Pressure versus Diameter')
legend('WT2272 up','WT2272 down','WT2283 up','WT2283 down',...
'WT2271 up','WT2271 down','location','southeast');
Good luck.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Stress and Strain についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!