how can i make this work

조회 수: 2 (최근 30일)
hedie adine zade
hedie adine zade 2020년 7월 12일
답변: Image Analyst 2020년 7월 12일
function physics
x = zeros(1,6);
for i=1:6
x(i) = input('enter your degree');
end
g = 9.91;l = 35;
v = (g/sin(x))*t;
t = 2*y / v;
y = (1/2)*(g/sin(x))
result=[x , t , v];
dlmwrite('file.txt',result)
end

답변 (2개)

madhan ravi
madhan ravi 2020년 7월 12일
편집: madhan ravi 2020년 7월 12일
x = zeros(6,1);
./ .*

Image Analyst
Image Analyst 2020년 7월 12일
y needs to come first, but even if you move it up right after the loop, t depends on v (so it needs v already), but v depends on t (which has not been defined yet). So you really need to rethink this. This will get you a little closer but you need to correct what I just said.
function physics
x = zeros(1,6);
for i=1:6
x(i) = input('Enter your degree ');
end
g = 9.91;
l = 35;
y = (1/2)*(g ./ sin(x)) % Needs only x so we're okay.
t = 2*y ./ v; % Needs v which is not defined yet.
v = (g ./ sin(x)) .* t; % Needs t but we couldn't get t because it needs this v!!!
result=[x(:), t(:), v(:)];
dlmwrite('file.txt',result)
end

카테고리

Help CenterFile Exchange에서 Assembly에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by