contour plot not working after using the help example
古いコメントを表示
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 件のコメント
KSSV
2020 年 5 月 28 日
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
2020 年 5 月 28 日
編集済み: Adam Danz
2020 年 5 月 28 日
Adam Danz
2020 年 5 月 28 日
The code above works for me in r2020a.
What version of Matlab are you using?
John D'Errico
2020 年 5 月 28 日
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
2020 年 5 月 28 日
Chinwendu Madubueze
2020 年 5 月 28 日
John D'Errico
2020 年 5 月 28 日
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
2020 年 5 月 28 日
編集済み: Chinwendu Madubueze
2020 年 5 月 28 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Contour Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!