フィルターのクリア

please help me to fix error and rectify it to a correct programme

1 回表示 (過去 30 日間)
Souvick roy
Souvick roy 2019 年 4 月 10 日
コメント済み: Souvick roy 2019 年 4 月 11 日
gamma=0.02
lambda=[0.01:0.0045:0.1]
beta=0.01
m=lambda/gamma
y2=[0.02:0.049:1]
y1=[0.0:0.001:0.02]
y=[y1 y2]
p=y2./lambda
q=y1./lambda
s=beta./lambda
v1=1-exp(-q)
v2=beta*(y2-gamma)+1-exp(-p)+4*sqrt(beta)*(sqrt(exp(-1./m))-sqrt(exp(-y2./lambda)))
v=[v1 v2]
%a
plot(m,v)
errors are
Error using plot
Vectors must be the same lengths.
Error in mytryplugveloctylmbda (line 15)
plot(m,v)
  2 件のコメント
Alex Mcaulley
Alex Mcaulley 2019 年 4 月 10 日
編集済み: Alex Mcaulley 2019 年 4 月 10 日
This is your problem:
length(m)
ans =
21
>> length(v)
ans =
42
What do you want to plot?
Probably is this:
plot(m,v1,m,v2)
Souvick roy
Souvick roy 2019 年 4 月 11 日
actually velocity law are hare depends on distance from
v1 is valid from y=0 to y=delta as mentioned y1
v2 valid from y=delta to y=1 as mentioned y2
and velocity is comprised of both i.ev1 is valid from y=0 to y=delta and v2 valid from y=delta to y=1
i want to plot v againest m

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

回答 (1 件)

David Wilson
David Wilson 2019 年 4 月 10 日
編集済み: David Wilson 2019 年 4 月 10 日
In general, it's better to use column vectors by default. That way you don't make mistakes like above when concatenating.
gamma=0.02
lambda=[0.01:0.0045:0.1]' % make a column vector
beta=0.01
m=lambda/gamma
y2=[0.02:0.049:1]'
y1=[0.0:0.001:0.02]'
y=[y1, y2]
p=y2./lambda
q=y1./lambda
s=beta./lambda
v1=1-exp(-q)
v2=beta*(y2-gamma)+1-exp(-p)+4*sqrt(beta)*(sqrt(exp(-1./m))-sqrt(exp(-y2./lambda)))
v=[v1, v2] % check that this is two columns
%a
plot(m,v)
  1 件のコメント
Souvick roy
Souvick roy 2019 年 4 月 11 日
actually velocity law are hare depends on distance from
v1 is valid from y=0 to y=delta as mentioned y1
v2 valid from y=delta to y=1 as mentioned y2
and velocity is comprised of both i.ev1 is valid from y=0 to y=delta and v2 valid from y=delta to y=1
i want to plot v againest m

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

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by