hi i'm writing a code for newton's 2nd law were very the mass
the first plot is Mass VS Acc
2ND Force VS Acc
3RD Force VS Mass
but i'm thinking i'm doing something wrong especially in the last plot because it look like the first one+ my axies are a bit wrong too so can anyone explain
clear
clc
subplot(3,1,1)
hold on
for m=0:100:1000
a=linspace(20,220,1000);
f=m.*a;
plot(f)
title('mass V/s Acceleration');
xlabel('acceleration');
ylabel('mass')
end
legend m=0 m=100 m=200 m=300 m=400 m=500 m=600 m=700 m=800 m=900 m=1000
subplot(3,1,2)
hold on
for m=0:100:1000
a=linspace(20,220,1000);
f=m.*a;
plot(a,f)
title('Force V/s acceleration');
xlabel('acceleration');
ylabel('Force')
end
legend m=0 m=100 m=200 m=300 m=400 m=500 m=600 m=700 m=800 m=900 m=1000
subplot(3,1,3)
hold on
for m=linspace(0,1000,11)
a=linspace(20,220,1000);
M=linspace(0,1000,1000);
f=m.*a;
plot(M,f)
title('Force V/s Mass');
xlabel('mass');
ylabel('Force')
end
legend m=0 m=100 m=200 m=300 m=400 m=500 m=600 m=700 m=800 m=900 m=1000

 Akzeptierte Antwort

VBBV
VBBV am 21 Okt. 2022

0 Stimmen

subplot(3,1,3)
hold on
for m=linspace(0,1000,11)
  a=linspace(20,220,1000);
  M=linspace(0,1000,1000);
  f=M.*a;. % use M 
  plot(M,f)
  title('Force V/s Mass');
xlabel('mass'); 
ylabel('Force')
end

If you use M instead of m you can notice the difference.

Weitere Antworten (1)

azarang asadi
azarang asadi am 19 Okt. 2022

0 Stimmen

your m is 0:100:1000 which is a 1*11 but your a is 1*1000. It should be same size.
so m = 1:1000

Kategorien

Mehr zu Discrete Events and Mode Charts finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 19 Okt. 2022

Beantwortet:

am 21 Okt. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by