Error with parentheses when doing semilogy
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have an error when calling some functions that says that I don't have all of my parentheses and because of this, my code have invalid matlab syntax. I don't know if someone will be able to help me but it would be very appreciated! Thank you !
clear all;
close all;
clc;
f = @(x, u) (-u.^3*x.^4)+(2*u.^3*x.^3)-(u.^2)*(u+1)*(x.^2)+(u.^2*x);
x0 = 0;
Nmax = 100;
Ea = 10e-10;
[r] = pointsFixes(f, x0, Nmax, Ea);
nn = length(r);
err = abs(r(1:nn-1)-r(2:nn));
figure(1);
semilogy(0;nn-2, err);
title("Erreur selon le nombre d'itération");
xlabel("n");
ylabel("E_n");
figure(2);
plot(0:nn-3,err(2:nn-1)./err(1:nn-2).^1);
title("Pts fixe")
xlabel("n");
ylabel("E_{n+1}/E_n");
0 Kommentare
Antworten (1)
Cris LaPierre
am 4 Nov. 2022
You have a syntax error in your inputs to semilogy. Did you mean to use a colon instead of a semicolon?
semilogy(0:nn-2, err);
% ^ colon?
0 Kommentare
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!