how can I plot graphs of function with various input arguments?

조회 수: 3 (최근 30일)
hyunmin
hyunmin 2014년 2월 28일
댓글: hyunmin 2014년 2월 28일
mfunction.m
function[P] = mfunction(v,M,R,T)
P=4*pi*(M/(2*pi*R*T)).^(3/2)*v.^2*exp((-M*(v.^2))/(2*R*T));
end
I want to make a graph. x would be v and the range is 1: 1200,
M = 0.032,R = 8.31, T= 300
and I want to plot " y=mfunction(x)"
and errors pop up.
??? Error using ==> mtimes Inner matrix dimensions must agree.
Error in ==> mmfunction at 2 P=4*pi*(0.032/(2*pi*8.31*300)).^(3/2)*x.^2*exp((-0.032*(x.^2))/(2*8.31*300));
How can I draw a graph?
please help me

채택된 답변

Chandrasekhar
Chandrasekhar 2014년 2월 28일
Hi, use the below script to plot the graph. I think this is what you are looking for,
for v = 1:1200
Y(v,1) = mfunction(v,0.032,8.31,300);
X(v,1) = v;
end
plot(X,Y)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by