i am trying to get the value of u_E using the equation, but matlab says it has error in that line which has the equation.

1 回表示 (過去 30 日間)
%creat symbol for axial force, length, thickness, displacemnent and width
syms f l t d w
%define governing equations for parameter
stress = f./(t*w)
strain = d./l
%measurement resolution and uncertainty
u_f = (f./100)./2./12;
u_l = 1/32/12/2;
u_t = 0.001/2/12;
u_d = (d./100)./2./12;
u_w = 0.001/12/2;
%zeroth order uncertainty
E = (f.*l)./(d.*w*t);
u_E = sqrt((diff(E,u_f).*u_f).^2 + (diff(E,u_d).*u_d).^2 + ...
(diff(E,u_l).*u_l).^2+(diff(E,u_t).*u_t).^2+(diff(E,u_w).*u_w).^2)
%define symbolic data
T = readtable('Intro_specimen 2.txt');
f = T{:,2};
l = 6.125;
t = 0.057;
d = (T{:,1})./12;
w = 0.414;
%substitute value into equation
stress = eval(stress);
strain = eval(strain);
%plot with errorbar
plot(strain,stress)
hold on
title('strain vs. stress')
xlabel('strain (ft^3)')
ylabel('stress (slug/ft^3)')

回答 (2 件)

Paul
Paul 2022 年 9 月 10 日
Hi kaixi
%creat symbol for axial force, length, thickness, displacemnent and width
syms f l t d w
%define governing equations for parameter
stress = f./(t*w);
strain = d./l;
%measurement resolution and uncertainty
u_f = (f./100)./2./12;
u_l = 1/32/12/2;
u_t = 0.001/2/12;
u_d = (d./100)./2./12;
u_w = 0.001/12/2;
%zeroth order uncertainty
E = (f.*l)./(d.*w*t);
u_E = sqrt((diff(E,u_f).*u_f).^2 + (diff(E,u_d).*u_d).^2 + ...
(diff(E,u_l).*u_l).^2+(diff(E,u_t).*u_t).^2+(diff(E,u_w).*u_w).^2)
In the Symbolic Math Toolbox, the function diff is used to diffentiate an expression with respect to a variable. So
diff(E,u_f)
means take the derivative of E wrt u_f, but u_f is an expression, not a variable. Similarly, u_l is a number, not a variable.
What exactly is the math that we're trying to implement?
  2 件のコメント
kaixi gu
kaixi gu 2022 年 9 月 10 日
i am trying to calculate the zeroth order of uncertainty using that equation, then i am trying to plot the graph with error bar. f is the force and d is the displacement, and they are a set of data from the txt file. l, t, w are constant value.
Torsten
Torsten 2022 年 9 月 10 日
f is the force and d is the displacement, and they are a set of data from the txt file.
And why - if they are data from a txt file - do you define them as syms ?

サインインしてコメントする。


Walter Roberson
Walter Roberson 2022 年 9 月 10 日

カテゴリ

Help Center および File ExchangeStress and Strain についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by