Having error with defining max points and graphing multiple things on one graph
2 ビュー (過去 30 日間)
古いコメントを表示
I figured out with some help how to graph the max deflection and max load on the same graph as the function line, bu I can not figure out how to fist off define the max stress and max strain points with the x and y components, as well as i can not figure out how to get the linear stress and linear strain to graph on the same plot as the function. It gets all messed up. my code is attached below, if someone could take a look it would be much appreciated.
clc;clear all,close all;
D = [0:0.1:1.4]/200;
L = [0 1 2 3 4 5 6 6.8 6.5 6 5.5 5.4 5.3 5.25 5.22]*1000;
%calculating the deflection and load
Deflection = [0:0.01:1.4]/200;
Load = spline(D,L,Deflection);
Load = Load+rand(size(Load));
[maxDeflectiony maxDeflectionx] = max(Deflection);
x_Defl_max = Deflection(maxDeflectionx);
y_Defl_max = Load(maxDeflectionx)
[maxLoady maxLoadx] = max(Load);
x_Load_max = Deflection(maxLoadx);
y_Load_max = Load(maxLoadx);
crossSecArea = 0.000015;
Stress = Load * crossSecArea;
Strain = ((Deflection-0.1)/0.1);
[UltStressy UltStressx] = max(Load) * crossSecArea;
x_UtlStress = Strain(UltStressx) * crossSecArea;
y_UltStress = Stress(UltStressx) * crossSecArea;
engineeringStrain = ((Deflection-0.1)/0.1);
linearStress = Stress(2:65);
linearStrain = Stress(2:65);
YM = linearStress./linearStrain;
youngsModulus = mean(YM);
figure(1)
handle_a = plot(Deflection,Load);
set(handle_a,'linewidth',1.5);
hold on
plot(x_Load_max,y_Load_max,'-.r*','MarkerSize',10,'MarkerFaceColor',[.49 1 .23]);hold on
plot(x_Defl_max,y_Defl_max,'-.go','MarkerSize',5,'MarkerFaceColor',[.49 1 .63]);hold off
handle_x = xlabel('Deflection [m]');
set(handle_x,'fontname','times','fontsize',16)
handle_y = ylabel('Load [N]');
set(handle_y,'fontname','times','fontsize',16)
handle_title = title('Deflection vs Load');
set(handle_title,'fontname','times','fontsize',20)
grid on
axis([0 0.0071 0 7000])
%print('-dpng','-r200','homework_4_plot2_DL')
figure(2)
handle_b = plot(Strain,Stress);
set(handle_b,'linewidth',1.5);
hold on
plot(x_UltStress,y_UltStress,'-.r*','MarkerSize',10,'MarkerFaceColor',[.49 1 .23]);hold on
%plot(x_Defl_max,y_Defl_max,'-.go','MarkerSize',5,'MarkerFaceColor',[.49 1 .63]);hold off
%plot(linearStress)
%hold on
%plot(linearStrain)
%hold on
handle_x = xlabel('Strain')
set(handle_x,'fontname','times','fontsize',16)
handle_y = ylabel('Stress [MPa]')
set(handle_y,'fontname','times','fontsize',16)
handle_title = title('Strain vs Stress')
set(handle_title,'fontname','times','fontsize',20)
grid on
1 件のコメント
dpb
2015 年 3 月 16 日
>> [UltStressy UltStressx] = max(Load) * crossSecArea;
Error using *
Too many output arguments.
>>
回答 (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!