simple x.y plot
Mostrar comentarios más antiguos
%Q2) Create a variable 𝑥 which is a vector containing multiples of 5 between
% 0 and 50.
x = (0:5:50)
% Compute the function 𝑦 and plot it against 𝑥 using red colour dash line
% with circle markers:
y = (4*(x^2)*log(6))+(5*(x^2)) / sqrt (cos(x).^2) +1
plot (x,y, r--o)
1 comentario
Markers inside the plot function are accessed using strtings/chars
%Q2) Create a variable 𝑥 which is a vector containing multiples of 5 between
% 0 and 50.
x = (0:5:50);
% Compute the function 𝑦 and plot it against 𝑥 using red colour dash line
% with circle markers:
y = ((4*(x.^2)*log(6))+(5*(x.^2))) ./ (sqrt (cos(x).^2)+1 );
plot (x,y, '--ro') % remember markers are accessed using strings/chars
Matlab intreprets any text placed outisde the chars/strings as variables of other data types and expects input values to those variables.
help plot
Respuestas (1)
Torsten
el 5 de Mzo. de 2024
Use
y = (4*(x.^2)*log(6))+(5*(x.^2)) ./ sqrt (cos(x).^2) +1
instead of
y = (4*(x^2)*log(6))+(5*(x^2)) / sqrt (cos(x).^2) +1
2 comentarios
Newer users tend to encounter this type of problem frequently as they start learning MATLAB. A couple releases ago (after 20 years I can't always remember offhand when we made certain changes :) I believe we enhanced the error message to try to provide more information about how to solve the problem.
%Q2) Create a variable 𝑥 which is a vector containing multiples of 5 between
% 0 and 50.
x = (0:5:50)
% Compute the function 𝑦 and plot it against 𝑥 using red colour dash line
% with circle markers:
y = (4*(x^2)*log(6))+(5*(x^2)) / sqrt (cos(x).^2) +1
Is there any information you think could be added to this message or a way to rephrase some or all of it that would help users (especially newer users) to more effectively understand the problem and correct it themselves, without having to reach out to Answers or other MATLAB experts in their vicinity?
Torsten
el 6 de Mzo. de 2024
Is there any information you think could be added to this message or a way to rephrase some or all of it that would help users (especially newer users) to more effectively understand the problem and correct it themselves, without having to reach out to Answers or other MATLAB experts in their vicinity?
Maybe by including a link to a documentation page where Array vs. Matrix Operations are explained in examples ?
Like here:
?
Categorías
Más información sobre Graphics Performance en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
