gpt4 book ai didi

MATLAB 轴具有恒定值

转载 作者:行者123 更新时间:2023-12-04 05:29:06 24 4
gpt4 key购买 nike

我正在做一个项目,它在 y 轴上绘制 deltaL,在 x 轴上绘制 Fnet。脚本如下:

%Variables for delta L
L=518;
E=1040000000;
A=0.0020268;

%Variables for Form Drag
Ad=25.437;
Cd=2.015;
p=999.835;
v=2.02917;

%Array for theta
theta=0:pi/360:pi/45;

Fd=0.5*p*Cd*v^2;

T=(L/2).*tan(theta);

Fnet=sqrt((T.^2)+(Fd.^2));

deltaL=(Fnet.*L)./(E.*A);

plot(Fnet,deltaL,'.');

当我绘制数据时,x 轴上的值都相同,y 轴上的值也相同。 x 和 y 值不同。但是,我的图表仍然为我的数据创建了一个工作模型。是否有一段我的代码导致了这个问题,或者 matlab 中是否存在一些可以以某种方式修复的故障?

最佳答案

那是因为 x/y 轴值的精度不够高。

您可以使用此页面中的技巧:http://www.mathworks.fr/support/solutions/en/data/1-3P8CU0/index.html?product=ML&solution=1-3P8CU0

old_ticks = get(gca, 'ytick')';
new_tick_labels = cellfun(@(x) sprintf('%9.6f',x), num2cell(old_ticks), 'uniformoutput', false);
set(gca, 'yticklabel', new_tick_labels)
old_ticks = get(gca, 'xtick')';
new_tick_labels = cellfun(@(x) sprintf('%9.6f',x), num2cell(old_ticks), 'uniformoutput', false);
set(gca, 'xticklabel', new_tick_labels)

结果(右键单击+“显示图像”以获得更好的分辨率):

enter image description here

关于MATLAB 轴具有恒定值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12851982/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com