Vector multiplication error no matter what I try

1 Ansicht (letzte 30 Tage)
Kara Landing
Kara Landing am 10 Apr. 2020
Kommentiert: Kara Landing am 10 Apr. 2020
I'm writing a code to help me graph the yield envelope for two ductile failure theories. I have all the equations I need, but I keep getting an error saying:
Error in * (line 317)
X = privBinaryOp(A, B, 'symobj::mtimes');
Error in PlottingDuctileFailureEnvelope (line 44)
yTopDE = ( sqrt(-4*(Mvar.^2)*(varxDE.^2) + 4.*Mvar + (Nvar.^2).*varxDE.^2) -
varxDE.*Nvar)./(2.*Mvar);
I'm confused, since there's no more *s in the equation in question that don't have a . in front of them.
I'm using MATLAB R2019a if that helps, and it's a student version.
Here's my code:
%%%% PRODUCES GRAPHS FOR THE MSS AND DE STRESS YIELD ENVELOPES
clear;
clc;
%input Sy
Sy = input('What is the yield strength of the material in the given units? ');
%for all tests, assuming Sy=1
%set (Sy,0) as an intercept point and the unknown b radius
x1 = Sy;
y1 = 0;
syms Brad;
%solving tilted ellipse equation for b radius
eqn1 = ( (1/(4*Sy^2)) + (1/(2*Brad^2)) )*x1^2 + ((1/(2*Sy^2)) + (1/(Brad^2)))*x1*y1 + ((1/(4*Sy^2)) + (1/(2*Brad^2)))*y1^2 == 1;
Brad = solve(eqn1,Brad);
%simplifying for less typing later
Mvar = (1/(4*Sy^2)) + (1/(2*Brad.^2));
Nvar = (1/(2*Sy^2)) + (1/(Brad.^2));
%use found b radius to plot the tilted ellipse for DE
%here are the equations to plot for the DE method
varxDE = linspace(-Sy,Sy);
yTopDE = ( sqrt(-4*(Mvar.^2)*(varxDE.^2) + 4.*Mvar + (Nvar.^2).*varxDE.^2) - varxDE.*Nvar)./(2.*Mvar);
yBotDE = -1*yTopDE;
%here is the stuff to plot for the MSS method
%Case 1
c1x = Sy;
c1y = linspace(0,Sy);
%case 3
c3x = linspace(-Sy,0);
c3y = -Sy;
%case 2
c2x = linspace(0,Sy);
c2y = c2x - Sy;
%now, to flip across y=x line
%case 1.1
c11x = linspace(0,Sy);
c11y = Sy;
%case 3.1
c31x = -Sy;
c31y = linspace(-Sy,0);
%case 2.1
c21x = linspace(-Sy,0);
c21y = c21x + Sy;
%hold on, plot functions, hold off
hold on
%equations
plot(c1x,c1y,c2x,c2y,c3x,c3y,c11x,c11y,c21x,c21y,c31x,c31y,'g');
plot(varxDE,yTopDE,varxDE,yBotDE,'r');
%axes and chart title
title('MSS and DE Stress Yield Envelope');
xlabel('sigma x axis (in given units)');
ylabel('sigma y axis (in given units)');
hold off
  2 Kommentare
Rik
Rik am 10 Apr. 2020
Please format your question with the tools in the top bar in the editor.
Kara Landing
Kara Landing am 10 Apr. 2020
Bearbeitet: Kara Landing am 10 Apr. 2020
How do I need to format it? This is my first time asking a question on here. Did that do it?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 10 Apr. 2020
Repaired code attached. You were missing some ./ and .* operations.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by