How to plot categorical data to compare with SimBiology simulation result?

조회 수: 1 (최근 30일)
Is there a way to extract a simbiology simulation result for one time point and then overaly the result to compare with actual data? I'd like to create something like this plot below. The x-axis in my case would represent different sections of tissue samples such as stomach or small intestine and all measuremets would be compared with simulation result from day= 5.
  댓글 수: 6
Arthur Goldsipe
Arthur Goldsipe 2022년 3월 9일
Oh, first of all, apologies for posting an answer as a comment. I meant to post the above as an answer. But maybe that's irrelevant since I didn't understand your question correctly.
Sadly, I'm still a little unclear on exactly what you need help with. Could you provide sample data and/or code that illustrates the problem? Something like "Here's sample data. Here's the code I've written so far. And here's a sketch of what I'd like the plot to look like for this example." You've certainly described those things at a high level, but it's hard to know what to suggest without a bit more detail.
If you have concerns over sharing anything publicly here, please feel free to contact me directly, or perhaps you could contact Technical Support.
Fearass Zieneddin
Fearass Zieneddin 2022년 3월 10일
편집: Fearass Zieneddin 2022년 3월 10일
Here's some sample data attached. Each coloumn is labeled for a certain tissue sample (cloumns C and D in excel) which is a catagorical score that ranges from (0-4) that describes the severity of diesase in these tissues. You can see there are multiple measurements that share the same y-value and x-value. So I would like to plot them in groups where my x-axis would display the corresponding tissue something like (colon and stomach). This is my first part of the question. The overall plot would look similar to the one shown above.
example code to extract plot scatter points from the data (how can I overlay the points next to each other as shown above):
%choose color red for group 1
scatter(sample_data.day(1:10, 1), sample_data.colon(1:10, 1),100 , 'red', 'x');
hold on;
scatter(sample_data.day(1:10, 1), sample_data.stomach(1:10, 1),100 , 'red', 'x');
ylim([0 4]); xlim([0 25]);
ylable('histopath severity score');
xlabel('time (days)');
%errorbars reprsent the standard error of the samples collected
errorbar(sample_data(1:10, 1), sample_data.colon_avg(1:10, 1), sample_data.colon_ste(1:10, 1));
errorbar(sample_data(1:10, 1), sample_data.stomach_avg(1:10, 1), sample_data.stomach_ste(1:10, 1));
Part 2: how can I overlay a single time point from my simulation to compare with the data presented in the table? My simulation has a contiuous time scale so I would like to extract the time point t= day 5 and compare it with the tissue measurements

댓글을 달려면 로그인하십시오.

답변 (1개)

Arthur Goldsipe
Arthur Goldsipe 2022년 3월 11일
If I understand your question, you're primarily asking how to extract the simulation results at a specific time (for example, 5 days). It sounds like you already have the simulation results, which you obtained by calling sbiosimulate. I'm assuming your simulation time units are day. However, it's not clear to me whether you have those results as a SimData object or as numeric arrays. If you have the results in SimData you can estimate the results at 5 days using the resample method. If you have the results in numeric arrays, you can estimate the resutls at 5 days using the interp1 function. In both cases, I default to the pchip interpolation method. Here's some sample code.
t = 5;
% Case 1: SimData
simdata = sbiosimulate(model);
simdata1 = resample(simdata, t, 'pchip');
[~,x1] = getdata(simdata1);
% Case 2: Numeric arrays
[tManyTimes,xManyTimes] = sbiosimulate(model);
x2 = interp1(tManyTimes, xManyTimes, 5, 'pchip');
% Now plot the data
plot(t, x1, 'o')
plot(t, x2, 'o')

카테고리

Help CenterFile Exchange에서 Perform Sensitivity Analysis에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by