give me Nan for r.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have to answer this question which is dificult to do it by hand so I tried to search for another method and I found this code but it won't work with me, and can you explain why yhe use of syms r phir phi in the begning? and why did they use eval?
clc; clear all; close all;
syms r phir phi
tol = 1e-6; %setting tolerance%
dr = tol + 1;
g = 0.9;
Ms = 100; %value of Ms was given%
Ma = 0.1; %value of Ma was given%
Ms_ = Ms*(1-g);
Mt_ = Ma + Ms_;
D = (1/3)* (Mt_);
del = sqrt(D/Ma); % del stand for delta%
y = 0.1 - (exp(-r/del)/(4*pi*D*r)); % the function I have from calculation%
r = 1;%assumption that r=1%
while (abs(dr) > tol)
dr = eval(y/(diff(y))); % to calculate dr%
r = r - dr; % the new value of r%
end
fprintf('R = '); %printing the result%
r
0 Commenti
Risposte (1)
Vedere anche
Categorie
Scopri di più su Numbers and Precision in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!