Error with parentheses when doing semilogy
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Cris LaPierre
on 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 Comments
See Also
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!