What is wrong with this code.

% disp('%% -- Aufgabe 2.2.3 -- %%');
% Gitter erzeugen
[x y]=meshgrid([-2:0.05:2],0);
% Differentialgleichung
dx=x-x.^3;
ylim_extra=[-1/3 -1/3];
% Stabilitätsanalyse, Fixpunkte und zeitlicher Verlauf
[substatusflag,handle]=stabilitaetsanalyse(x,y,dx,zeros(size(y)),[],[],5,ylim_extra);
Unrecognized function or variable 'stabilitaetsanalyse'.
for i_count=2:4
set(handle(i_count),'XTick',[-2:2])
end
skizze_zeitverlauf(x,dx,5);
hold on % Analytische Lösung
t=0:0.05:2;
for startval=-2:0.25:2
C=(startval)/sqrt(1-startval^2);
plot(0,startval,'o','MarkerFaceColor',[0.75 0 0], ...
'MarkerEdgeColor',[0.75 0 0])
plot(t,exp(t)*C./sqrt(1+exp(2*t)*C^2), ...
'LineWidth',2,'Color',[0.75 0 0])
end

5 Commenti

It seems you have copied the code from somewhere and you don't have the user-defined functions "stabilitaetsanalyse" and "skizze_zeitverlauf".
You should ask the author of the code for these functions. We can not help you with this.
https://www.researchgate.net/profile/Mohamed-B-Debbat/post/Strogatz_book_exercise_solutions/attachment/5c40a5733843b00675511560/AS%3A716089843531776%401547740531243/download/solution_manual_of_non_linear_dynamics.pdf related I suspect
Yes, I have copied it from "Debbat/post/Strogatz_book_exercise_solutions/attachment/5c40a5733843b00675511560/AS%3A716089843531776%401547740531243/download/solution_manual_of_non_linear_dynamics.pdf".
As you have mentioned. Is it possible that you can provide the code in easy way...thanks in advance.
"Is it possible that you can provide the code in easy way...thanks in advance."
As I mentioned earlier - We can not help you with this. You should ask the author of the code for these functions.
The author of that code appears to be Dominik Zobel who was at dominik.zobel@tu-harburg.de
They posted code at a server that no longer exists.

Accedi per commentare.

Risposte (1)

Sam Chak
Sam Chak il 11 Set 2023
Modificato: Sam Chak il 11 Set 2023
Update: Thanks to @Walter Roberson for finding the source (PDF). The MATLAB functions stabilitaetsanalyse() and skizze_zeitverlauf() are unavailable. However, I tried to duplicate the results on page 3, section 2.2.3.
syms x(t) C
eqn = diff(x,t) == x - x.^3;
cond = x(0) == C; % initial value
xSol = dsolve(eqn, cond);
xSol = simplify(xSol)
xSol = 
c = -2:0.25:2; % range of initial values
for j = 1:numel(c)
xt = subs(xSol, C, c(j));
if c(j) >= 0
fplot( xt, [0 2], 'r'), hold on
else
fplot(-xt, [0 2], 'r'), hold on
end
end
hold off, grid on
xlabel('t')
ylabel('x(t)')

Prodotti

Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by