Solving equations with different ranges
Afficher commentaires plus anciens
I need to get the values of P by using different equations under different values of S, as shown in the attached image. I have written codings for the equations but could someone please guide me on how can I make the equations work along with the given different range of S?
sigma0=5; Lf=12; S=0:0.01:600; S0=0.18; %arbitrary values
P=sigma0*[2*sqrt(S/S0)-(S/S0)]; %Run this eq. for S=<S0 (S is less than & equal to S0)
P=sigma0*(1-2*S/Lf)^2; %Run this eq. for S0<=S<=Lf/2
P=0; %Run this eq. for S>=Lf/2
The value of S0 will be a constant value which I will get by solving another set of equation (not included in this query). All of the values I have taken are arbitrary. Later I will be plotting the resultant values of P and for corresponding values of S.
Thank you

1 commentaire
jack carter
le 30 Août 2017
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 30 Août 2017
0 votes
If you have the symbolic toolbox, you could code in terms of piecewise()
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!