How to plot a function for different values of input parameter in a function
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
Please, how do I create a procedure/function such that it carries \xi as an input and use it to plot r for different values of \xi. I have attached my code.
댓글 수: 0
답변 (1개)
Torsten
2022년 9월 13일
Just define xi as a column vector of values, e.g.
xi = [0.03 0.06].'; % activity parameter
댓글 수: 11
Torsten
2022년 9월 13일
%% initialization
clear
clc
close all
%% Model parameters
global k1 eta1 alpha3 gamma1 d N Phi xi h A B C G
k1 = 6*10^(-12); % elastic constant
eta1 = 0.0240; % viscosity
xi = [-0.02 0.01 0.0].'; % activity parameter
alpha3 = -0.001104; % viscosity
gamma1 = 0.1093; % viscosity
Theta = 0.0001;
d = 0.0002;
%% Extract r(q) data from maple
%rqdata= xlsread('rqdata.xlsx');
%rq= rqdata(:,2);
%qsize = rqdata(:,1);
%% r(q) from matlab
alpha=1-alpha3^2/gamma1/eta1;
q=0:0.001:(5*pi);
r=q-(1-alpha)*tan(q)+(alpha3*xi*alpha/eta1)./(4*k1*q.^2/d^2-alpha3*xi/eta1).*tan(q);
% Plotting r(q)
%figure
%hold on
%plot(qsize,rq, 'r', MarkerSize=2)
plot(q,r, 'b--', MarkerSize=2)
xlabel('t (seconds)')
ylabel('\theta(d/2,t)(rad)')
legend('maple', 'matlab')
axis([0 5*pi -20 20])
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!