
Trying to find root of equation with fzero command in Matlab.
    8 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
I want to solve a problem in which I am given a function (seen below) where W is 4.9 and I must find v. I have to use the fzero method but I am having trouble with this as I only know how to find the roots. How can I do this? (Function file and script file ARE separate and below)
function W = dforce(v)
R = 287;
P = 101300;
d = 15;
A = (pi*d^2)/4;
T = linspace(-60,60,121);
b1 = 2.156954157e-14;
b2 = -5.332634033e-11;
b3 = 7.477905983e-8;
b4 = 2.527878788e-7;
mu = b1*T.^3+b2*T.^2+b3*T+b4;
ro = P./(R*T);
Re = (ro*v*d)/mu;
Cd = (24/Re)+(6/(1+sqrt(Re)))+0.4;
W = Cd*0.5*ro*v^2*A;
end
___________________________________________________________________________________ clear all, close all
m = 0.5;
g = 9.8;
N = m*g;
dF = @(v) dforce(v)- N;
V = fzero(dF,0);
1 commentaire
Réponses (2)
  Orion
      
 le 7 Nov 2014
        Why is T a vector ?
usually, fzero is used to solve an equation to find one scalar solution.
  Orion
      
 le 7 Nov 2014
        that seems more logic for me.
use the syntax for using an extraparameter to your function.
% here's an example from the matlab documentation.
myfun = @(x,c) cos(c*x);  % parameterized function
c = 2;                    % parameter
fun = @(x) myfun(x,c);    % function of x alone
x = fzero(fun,0.1)
in your case, you should do something like
for T = linspace(-60,60,121);
  dF = @(v) dforce(v,T)- N;
  V = fzero(dF,0);
end
0 commentaires
Voir également
Catégories
				En savoir plus sur Variables 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!


