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

1 Ansicht (letzte 30 Tage)
Souvick roy
Souvick roy am 10 Apr. 2019
Kommentiert: Souvick roy am 11 Apr. 2019
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 Kommentare
Alex Mcaulley
Alex Mcaulley am 10 Apr. 2019
Bearbeitet: Alex Mcaulley am 10 Apr. 2019
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 am 11 Apr. 2019
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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

David Wilson
David Wilson am 10 Apr. 2019
Bearbeitet: David Wilson am 10 Apr. 2019
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 Kommentar
Souvick roy
Souvick roy am 11 Apr. 2019
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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by