how to calculate scalar with matrix
2 ビュー (過去 30 日間)
古いコメントを表示
I need to code the following: I got to part b and I am unsure how to get a scalar in the code.
Goal: (b)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1611341/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1611346/image.png)
% chapter 2-1
clear; clc; close all
%% normal stress
fprintf('\n ====== Exercise 2.1 a=======\n\n')
tau = [-30 -20; -20 -40]; %2D stress tensor (Mpa)
theta = 10;
fhat = [sind(theta) , cosd(theta)];
nhat = [ cosd(theta) , -sind(theta)];
tnhat = tau * nhat.';
tn = nhat * tnhat %normal stress
%% shear stress
ts = fhat * tnhat
fprintf('\n ====== Exercise 2.1 a end=======\n\n')
%%
fprintf('\n ====== Exercise 2.1 b =======\n\n')
I = [1 0; 0 1];
det[-30-x -20; -20 -40-x] = 0
fprintf('\n ====== Exercise 2.1 b end=======\n\n')
2 件のコメント
VBBV
2024 年 2 月 8 日
編集済み: VBBV
2024 年 2 月 8 日
syms lambda % define lambda as symbolic variable (eigen value)
tau = [-30 -20; -20 -40]; % shear stress
I = [1 0; 0 1]; % identity matrix
S = det(tau - I*lambda) % determinant of characteristic equation
sol = solve(S==0,lambda) % solve for eigen values
double(vpa(sol))
参考
カテゴリ
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!