Error using plot Conversion to double from sym is not possible. Error in MAE315_Intro_Project (line 66) plot(epsilon,sigma,Repsilon,Rsigma,'o').
2 次查看(过去 30 天)
显示 更早的评论
Does anybody know why I am getting those errors? I cannot figure it out at all. Any help would be greatly appreciated. Thanks! See below for my code.
clear all; close all; clc;
load data
syms F t w
% Uncertainties
u_F = F .* 0.01
u_m = 0.001/2
% Equations for Uncertainty
A = t.*w; % Area
sigma = F./A % Stress
% Uncertainty
u_sigma = sqrt((diff(sigma,F).*u_F).^2 + (diff(sigma,t).*u_m).^2 +...
(diff(sigma,w).*u_m).^2)
% Givens
D = Dat(1:1953,1);
F = Dat(1:1953,2);
t = 0.094; % Thickness, inches
w = 0.370; % Width, inches
l = 6.500; % Length, inches
L = l + D; % Displaced Length
epsilon = (L - l)./l %Strain
sigma = subs(sigma)
u_sigma = subs(u_sigma)
% Plot Stress vs Strain
figure (1)
plot(epsilon, sigma)
xlabel('Strain')
ylabel('Stress')
title('Stress vs Strain')
% Ultimate Stress
Usigma = max(sigma)
% Ultimate Strain
index = find(sigma==Usigma)
Uepsilon = epsilon(index)
% Plot Ultimate Stress and Strain
figure (2)
plot(epsilon,sigma,epsilon(index),Usigma,'o')
xlabel('Strain')
ylabel('Stress')
title('Ultimate Stress & Ultimate Stress Point')
% Rupture Stress
Fm = Dat(1953:1953,2); % Max Force
Rsigma = Fm./A
% Rupture Strain
Dm = Dat(1953:1953,1); % Max Displacement
Lm = l + Dm; % Max New Length after Max Displacement
Repsilon = (Lm - l)./l
% Plot Rupture Stress and Strain
figure (3)
plot(epsilon,sigma,Repsilon,Rsigma,'o')
xlabel('Strain')
ylabel('Stress')
title('Rupture Stress & Rupture Stress Point')
0 个评论
采纳的回答
Star Strider
2015-9-11
It’s best to not use the Symbolic Math Toolbox functions unless you need to do symbolic operations. It’s not intended for routine numerical computation.
What variables are you loading from your ‘data’ file?
I can’t run your code, so I can’t experiment with it. However, I would put everything before the ‘%Givens’ after them instead (except the load call). Then you could completely avoid the Symbolic Toolbox function calls (such as subs) and the problems they create for you later.
8 个评论
Star Strider
2015-9-12
Yes.
Don’t use the Symbolic Toolbox for this. Once you have anonymous functions for ‘u_sigma’ and any others you may need, evaluate them as strictly numeric vectors and plot them.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Stress and Strain 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!