Can I make this kind of graph in matlab?
1 次查看(过去 30 天)
显示 更早的评论
Sorry, I don't know what to call it. Here's a screenshot:
0 个评论
采纳的回答
Star Strider
2014-7-29
I don’t know exactly what sort of format the data is that you’re plotting in those (it seems to be host response to an infectious agent of some sort) but you can likely reproduce plots like that with the image, colorbar and colormap functions. You will have to experiment with them to get the result you want.
6 个评论
Star Strider
2014-7-30
I apologize for not wanting to read and understand a 35-page paper just now, so I simply scanned it. (It is in an area of my expertise, and looks very interesting, but I have other things I need to read.) If you use an independent variable, for instance ‘I’ here, in place of time (perfectly legitimate), you can’t null it with ‘~’ in your ODE arguments. You also have to define it with respect to your ODE variables, for instance:
function dX = ode(I,X,T)
to tell your ODE to treat ‘I’ as your independent variable.
With respect to your for loop, I suggest you change it to:
treatment = 1e-4:1e-5:1e-3;
for k1 = 1:length(treatment)
[t(:,k1),X(:,:,k1)] = ode45(@ode, [0 4.5e4], [1e4 0 0], [] , treatment(k1));
end
I didn’t run this, so be sure ‘X’ is saved correctly, but since the outputs of the ODE functions are column variables, it should work. Taking the plot call out of your loop will speed things up considerably. Plot the appropriate variables (saved in t and X) outside the loop. If you define ‘t’ as something else (for instance ‘I’), you might want to define it with that variable name in the output of your ode45 call. Also, you didn’t say exactly how you were using it as tspan, but rather than a two-element range, I suggest you use a vector of defined values for ‘I’.
That should get you going. I’ll follow this until your code works, which it should since the paper’s authors got it to work.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!