ccdesign help to create this calculation
5 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!