Vector multiplication error no matter what I try

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 Comments

Please format your question with the tools in the top bar in the editor.
How do I need to format it? This is my first time asking a question on here. Did that do it?

Sign in to comment.

 Accepted Answer

Repaired code attached. You were missing some ./ and .* operations.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Release

R2019a

Community Treasure Hunt

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

Start Hunting!