Azzera filtri
Azzera filtri

How to change the values of both axes

3 visualizzazioni (ultimi 30 giorni)
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:

Risposta accettata

Star Strider
Star Strider il 11 Ott 2021
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 Commenti
Star Strider
Star Strider il 11 Ott 2021
As always, my pleasure!
.

Accedi per commentare.

Più risposte (1)

Chunru
Chunru il 11 Ott 2021
%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 Commenti
Yu Xian Lim
Yu Xian Lim il 11 Ott 2021
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 il 12 Ott 2021
This is to turn off the exponents if you have different values for two axes.

Accedi per commentare.

Categorie

Scopri di più su Stress and Strain in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by