could you please translate the following code for me?
Afficher commentaires plus anciens
Hello, I'm copying a certain code from a lecture on singularity functions.. Could anyone explain the steps of the following code for me? I'm a beginner in MATLAB :( i got the following questions?? why to use a linspace? why to use a loop? Is it because we are dealing with a vector? Why is he chaning the variable from x-->xx-->> xxx
This is highly appreciated.. ---------------------------------------------------------------------------
function beam(x)
xx = linspace(0,x);
n=length(xx);
for i=1:n
uy(i) = -5/6.*(sing(xx(i),0,4)-sing(xx(i),5,4));
uy(i) = uy(i) + 15/6.*sing(xx(i),8,3) + 75*sing(xx(i),7,2);
uy(i) = uy(i) + 57/6.*xx(i)^3 - 238.25.*xx(i);
end
plot(xx,uy)
function s = sing(xxx,a,n)
if xxx > a
s = (xxx - a).^n;
else
s=0;
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!