필터 지우기
필터 지우기

ccdesign help to create this calculation

조회 수: 2 (최근 30일)
MINATI PATRA
MINATI PATRA 2024년 5월 8일
답변: Shivani 2024년 6월 18일
exp = ccdesign(3,'type','circumscribed'); exp(exp>=1) = 1; exp(exp<=-1) = - 1;
EXP = subs(exp,{-1,0,1},vpa({0.01,0.02,0.03}));
%% I want to recreate 'exp' by 'EXP' to write in an excel sheet created by Matlab
%% Want Matlab to create an excel sheet with variable names as 'p1', 'p2', and 'p3', then in next column calculate N
A = 1; B = 2.5; C = 0.001; N = A.p1 + B.p2 + C.p3; % and then want the surf plot
figure(1),surfc(N),xlim(-1,1),ylim(-1,1)

채택된 답변

Shivani
Shivani 2024년 6월 18일
To achieve the intended results, kindly refer to the code snippet provided below. This implementation is based on my understanding of the question you've posted:
exp = ccdesign(3,'type','circumscribed');
exp(exp >= 1) = 1;
exp(exp <= -1) = -1;
% Assuming you want to map -1, 0, 1 to 0.01, 0.02, 0.03, respectively
EXP = exp;
EXP(exp == -1) = 0.01;
EXP(exp == 0) = 0.02;
EXP(exp == 1) = 0.03;
T = array2table(EXP, 'VariableNames', {'p1', 'p2', 'p3'});
% Write the table to an Excel file
filename = 'experiment_design.xlsx';
writetable(T, filename);
A = 1; B = 2.5; C = 0.001;
% Calculate N using vectorized operations
N = A * T.p1 + B * T.p2 + C * T.p3;
% Add N as a new column to your table
T.N = N;
writetable(T, 'experiment_design_with_N.xlsx');
Creating a surface plot using 'surfc' directly from the variable (N) as you've described isn't straightforward because (N) is calculated from the experimental design and doesn't directly map to a grid of (p1), (p2), and (p3) values. Usually, surface plots are created from functions of two variables (e.g., (f(x, y))), but your calculation involves three parameters ((p1), (p2), (p3)). Therefore, as per my knowledge, it may not be possible to plot a surface plot directly.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by