フィルターのクリア

How to change the values of both axes

3 ビュー (過去 30 日間)
Yu Xian Lim
Yu Xian Lim 2021 年 10 月 11 日
コメント済み: Chunru 2021 年 10 月 12 日
I am trying to change the values of both axes from scientific notation to general form but I don't know how
Below is my code:
%Define variables
sigma = 35*10^6;
young_modulus = 90*10^9;
strain_coefficient = 6*10^-9;
magnetic_field = linspace(0, 160000);
%Function
stress = (sigma/young_modulus) + (strain_coefficient*magnetic_field);
%Create Plot
plot(magnetic_field, stress)
xlabel('Magnetic Field Intensity (A/m)')
ylabel('Microstrain (m/m)')
title('Microstrain vs. Magnetic Field Intensity')
This is the result I am looking for:

採用された回答

Star Strider
Star Strider 2021 年 10 月 11 日
There are ways to change the exponent display of the axis rulers using the NumericRuler Properties, however that is not necessary here. Just multiply the plot arguments by the appropriate scaling factors —
%Define variables
sigma = 35*10^6;
young_modulus = 90*10^9;
strain_coefficient = 6*10^-9;
magnetic_field = linspace(0, 160000);
%Function
stress = (sigma/young_modulus) + (strain_coefficient*magnetic_field);
%Create Plot
figure
plot(magnetic_field, stress)
xlabel('Magnetic Field Intensity (A/m)')
ylabel('Microstrain (m/m)')
title('Microstrain vs. Magnetic Field Intensity')
figure
plot(magnetic_field*1E-3, stress*1E+6)
xlabel('Magnetic Field Intensity (kA/m)')
ylabel('Microstrain (\mum/m)')
title('Microstrain vs. Magnetic Field Intensity')
Make appropriate changes to get different results.
.
  4 件のコメント
Yu Xian Lim
Yu Xian Lim 2021 年 10 月 11 日
got it! thanks!
Star Strider
Star Strider 2021 年 10 月 11 日
As always, my pleasure!
.

サインインしてコメントする。

その他の回答 (1 件)

Chunru
Chunru 2021 年 10 月 11 日
%Define variables
sigma = 35*10^6;
young_modulus = 90*10^9;
strain_coefficient = 6*10^-9;
magnetic_field = linspace(0, 160000);
%Function
stress = (sigma/young_modulus) + (strain_coefficient*magnetic_field);
%Create Plot
plot(magnetic_field/1000, stress*1e6)
xlabel('Magnetic Field Intensity (kA/m)')
ylabel('Microstrain (\mu m/m)')
title('Microstrain vs. Magnetic Field Intensity')
h=gca;
% Turn off the exponents
h.XAxis.Exponent=0;
h.YAxis.Exponent=0;
  2 件のコメント
Yu Xian Lim
Yu Xian Lim 2021 年 10 月 11 日
Is there a reason why we need these lines:
h=gca;
% Turn off the exponents
h.XAxis.Exponent=0;
h.YAxis.Exponent=0;
I tried it without these lines and it works the same?
Chunru
Chunru 2021 年 10 月 12 日
This is to turn off the exponents if you have different values for two axes.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStress and Strain についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by