フィルターのクリア

This code give me an error of Index exceeds array bounds.

1 回表示 (過去 30 日間)
MUHAMMAD UBAID KHALID
MUHAMMAD UBAID KHALID 2023 年 4 月 24 日
回答済み: Alan Stevens 2023 年 4 月 24 日
clc
clear all
close all
m=60;
g=9.81;
k=80;
m_2=10;
m_1=15;
h=100;
w=15;
t=1:100:10;
for i=1:t
x(i)=((m*g)/k)+((m_2*(g*h)^1/2)*sin(w*t)/(w(m_1+m_2)))-((m*g)*cos(w*t)/k)
end
plot(t,x(i))

回答 (1 件)

Alan Stevens
Alan Stevens 2023 年 4 月 24 日
More like this?
m=60;
g=9.81;
k=80;
m_2=10;
m_1=15;
h=100;
w=15;
t=1:10:100;
x = zeros(1,numel(t));
for i=1:numel(t)
x(i)=((m*g)/k)+((m_2*(g*h)^1/2)*sin(w*t(i))/(w*(m_1+m_2)))-((m*g)*cos(w*t(i))/k);
end
plot(t,x,'o--')

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by