MEAN AND ROOT MEAN SQUARE

Hi Everyone, I need your kind and Urgent assistance on my Phd work on Root Mean Square. The code i wrote is writting error.
clear all; close all; clc; %RMS%
V=1;
ch=0.2;
Y=0.5;
q1=0;
q2=0;
p1=0.2;
E=0.2;
p2=sqrt(2*E- p1^2);
dt=1/5;
fs=1/dt;
tspan=100:dt:1000;
K=[0 0.01 0.021 0.022790 1.5];
m=length(K);
for c=1:m;
[t{c},x{c}]=ode23tb(@(t,x)TH(t,x,ch,V,Y,K(c)),tspan,[q1 q2 p1 p2]);
end
Y=x{:,1};
Z=x{:,2};
P=x{:,3};
T=x{:,4};
G=x{:,5};
L=length(tspan);
f = (0:L-1)*(fs);
rms1 = sqrt(mean((Y(:,1)).^2));
rms2 = sqrt(mean((Y(:,2)).^2));
figure
plot(t,rms1);
hold on
plot(t,rms2)
xlabel('t');
ylabel('x1,x2');%ylim([-1 1]);
THIS IS THE ERROR AM GETTING
Error in Untitled2 (line 29)
plot(t,rms1);
THANKS IN ANTICIPATION.

1 件のコメント

DGM
DGM 2021 年 8 月 12 日
The error you posted should have said more than that. Paste the whole error message. Given that variables are missing, nobody can run this code.
What are the size of t and rms1?

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

回答 (1 件)

tiwwexx
tiwwexx 2021 年 8 月 11 日

0 投票

I don't think that matlab likes that you're using curly brackets. Try changing all { } to ( ).

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

リリース

R2016a

質問済み:

2021 年 8 月 11 日

コメント済み:

DGM
2021 年 8 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by