contour plot not working after using the help example
Afficher commentaires plus anciens
please help me. My contour is not working. I follow step by step example in Matlab HELP to plot my own work. it keep showing this message. The code is giving below. Thank you.
Index exceeds matrix dimensions.
Error in ==> contour>parseargs at 135
if ischar(args{end})
Error in ==> contour at 67
[pvpairs,args,msg] = parseargs(args); %#ok
clear all
close all
R0 = beta / gamma * (alpha * gamma + gamma * R * (1 - alpha)) + tau;
alpha = 0.4;
beta = 0.25;
gamma = 0.2;
omega = 0.2;
xi = 0.05;
R1 = linspace(0,1,100);
tau1 = linspace(0,1,10);
[tau R] = meshgrid(tau1,R1);
mesh(tau,R,R0) %interpolated
axis tight; hold on
plot(tau,R,R0,'.','MarkerSize',15) %nonuniform
8 commentaires
KSSV
le 28 Mai 2020
You have not used contour in the above code. First, is the above code running ? Is it showing the error ypu have mentioned?
Chinwendu Madubueze
le 28 Mai 2020
Modifié(e) : Adam Danz
le 28 Mai 2020
Adam Danz
le 28 Mai 2020
The code above works for me in r2020a.
What version of Matlab are you using?
John D'Errico
le 28 Mai 2020
If I had to make a bet, it would be that you named a script file with some name. The name of that script might have been something dangerous, like contour. After all, you were trying to do a contour plot. That is a bad thing to do, as then MATLAB gets confused when you try to use the actual code.
So exactly what did you name that script?
You would get better help is, when you get an error message, you report the ENTIRE error message text. Thus EVERYTHING IN RED. Then we could look at it and know what you did. But when you report an abbreviated version, with only what you think seems important, invariably the person chooses to report the wrong information. So instead we need to get you to tell us what you did.
Chinwendu Madubueze
le 28 Mai 2020
Chinwendu Madubueze
le 28 Mai 2020
John D'Errico
le 28 Mai 2020
You named the script "contour plot.m" with a space between the two words? Is that how I should read what you said? If so, you need to realize that is not a valid name for a script in MATLAB.
Chinwendu Madubueze
le 28 Mai 2020
Modifié(e) : Chinwendu Madubueze
le 28 Mai 2020
Réponses (0)
Catégories
En savoir plus sur Contour Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!