Error with parentheses when doing semilogy
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Cris LaPierre
2022년 11월 4일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!