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

1 view (last 30 days)
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 Comments
Alex Mcaulley
Alex Mcaulley on 10 Apr 2019
Edited: Alex Mcaulley on 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 on 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

Sign in to comment.

Answers (1)

David Wilson
David Wilson on 10 Apr 2019
Edited: David Wilson on 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 Comment
Souvick roy
Souvick roy on 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

Sign in to comment.

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!