Error using plot Conversion to double from sym is not possible. Error in MAE315_Intro_Project (line 66) plot(epsil​on,sigma,R​epsilon,Rs​igma,'o').

5 visualizzazioni (ultimi 30 giorni)
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')

Risposta accettata

Star Strider
Star Strider il 11 Set 2015
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 Commenti
Alexander McGlone
Alexander McGlone il 12 Set 2015
Okay so I finally got this uncertainty portion to work. Thank you for both of your help. I still however cannot get the last plot to plot. It's giving me the same error I had originally in the question.
Do either of you understand what that error means? And how I can fix it? Thanks.
Star Strider
Star Strider il 12 Set 2015
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.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by