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

1 vue (au cours des 30 derniers jours)
Souvick roy
Souvick roy le 10 Avr 2019
Commenté : Souvick roy le 11 Avr 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 commentaires
Alex Mcaulley
Alex Mcaulley le 10 Avr 2019
Modifié(e) : Alex Mcaulley le 10 Avr 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 le 11 Avr 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

Connectez-vous pour commenter.

Réponses (1)

David Wilson
David Wilson le 10 Avr 2019
Modifié(e) : David Wilson le 10 Avr 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 commentaire
Souvick roy
Souvick roy le 11 Avr 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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by