Data plot for different values
显示 更早的评论
I want plot theta as a function of z at t = time(nt) for all xi values but receive: Error using plot: Data cannot have more than 2 dimensions om line 140.
采纳的回答
%store your outputs for each xi
thetaxivalues(ixi,:,:) = theta(:,:);
vxivalues(ixi,:,:) = v(:,:);
What is ixi ? I guess, it's a single scalar, namely ixi = nxi from the last loop where ixi appears:
for ixi = 1:length(xivalues)
xi = xivalues(ixi);
end
So you don't store outputs for each xi.
8 个评论
I actually wants the xi to take values from xivalues = linspace(-0.3, -0.1, nxi).
But your vector "theta" does not depend on xi.
So it makes no sense to set
thetaxivalues(1:nxi,:,:) = theta(:,:);
vxivalues(1:nxi,:,:) = v(:,:);
because every vector thetaxivalues and vxivalues will contain the same values for 1 <= ixi <= nxi.
You are right but what do you suggest then?
Your simulations must contain xi as a parameter and you must vary this parameter to get theta(xi,:,:) and v(xi,:,:).
Please, could you help me out.
How could I ?
I don't know anything about your model, and at the moment, I don't see a variable xi within the equations in lcode1 that could be varied.
If you cehck the discretised equations, I have xi in the v equation.
Please check, you will see: (xi/(2*h))*(theta(N-1)-theta(N-3));
Then call the solver in a loop over the elements of xi and write the results in a 3d v and theta array.
But that's really standard and I won't do that for you.
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
