Tag Archives: matlab
create a 3D average plan (or normal) from two 3D plans (or normals)
How can I determine the average plan knowing the plans of the two attached sets of nodes?
load plan_1_2.mat
figure
plot3(plan_1(:,1),plan_1(:,2),plan_1(:,3),’mo’,’Markersize’,4); % normal 1
hold on
plot3(plan_2(:,1),plan_2(:,2),plan_2(:,3),’go’,’Markersize’,4); % normal 2
hold off
axis equal
xlabel(‘x’)
ylabel(‘y’)
zlabel(‘z’)
grid off
Or, is it possible to create an average normals?How can I determine the average plan knowing the plans of the two attached sets of nodes?
load plan_1_2.mat
figure
plot3(plan_1(:,1),plan_1(:,2),plan_1(:,3),’mo’,’Markersize’,4); % normal 1
hold on
plot3(plan_2(:,1),plan_2(:,2),plan_2(:,3),’go’,’Markersize’,4); % normal 2
hold off
axis equal
xlabel(‘x’)
ylabel(‘y’)
zlabel(‘z’)
grid off
Or, is it possible to create an average normals? How can I determine the average plan knowing the plans of the two attached sets of nodes?
load plan_1_2.mat
figure
plot3(plan_1(:,1),plan_1(:,2),plan_1(:,3),’mo’,’Markersize’,4); % normal 1
hold on
plot3(plan_2(:,1),plan_2(:,2),plan_2(:,3),’go’,’Markersize’,4); % normal 2
hold off
axis equal
xlabel(‘x’)
ylabel(‘y’)
zlabel(‘z’)
grid off
Or, is it possible to create an average normals? norm, normal, average, mean, plan, 3d, 3d plots MATLAB Answers — New Questions
Unable to write to Simulink cache file ‘C:modelname.slxc’ because you do not have write permission for the file.
when I am trying to generate c code from my model, I encounter this error, how to resolve this?
Unable to write to Simulink cache file ‘C:modelname.slxc’ because you do not have write permission for the file.when I am trying to generate c code from my model, I encounter this error, how to resolve this?
Unable to write to Simulink cache file ‘C:modelname.slxc’ because you do not have write permission for the file. when I am trying to generate c code from my model, I encounter this error, how to resolve this?
Unable to write to Simulink cache file ‘C:modelname.slxc’ because you do not have write permission for the file. simulink, code generation MATLAB Answers — New Questions
What is wrong with this code for finding out the number of significant digits after decimal?
I have created this code for finding the number of siignificant digits after decimal for Cody, but for some reason, it shows error (semantic). Can anyone please help identify why? Thank you.
The error comes when I apply:
x = [1.000 1.04 0.22 10.1; 2.05 2.33 4.1 1000.31; 5.00010 6.429 7.492 8.0]
I tried debugging, but the error comes due to 6.429 having a ‘1’ after another 11 zeroes.
Code:
function y = find_max_sigdec(x)
stop = 0;
i = 0;
if x == fix(x)
y = 0;
else
while stop == 0
x = x*10;
i = i+1;
if x == fix(x)
y = i;
stop = 1;
end
end
end
endI have created this code for finding the number of siignificant digits after decimal for Cody, but for some reason, it shows error (semantic). Can anyone please help identify why? Thank you.
The error comes when I apply:
x = [1.000 1.04 0.22 10.1; 2.05 2.33 4.1 1000.31; 5.00010 6.429 7.492 8.0]
I tried debugging, but the error comes due to 6.429 having a ‘1’ after another 11 zeroes.
Code:
function y = find_max_sigdec(x)
stop = 0;
i = 0;
if x == fix(x)
y = 0;
else
while stop == 0
x = x*10;
i = i+1;
if x == fix(x)
y = i;
stop = 1;
end
end
end
end I have created this code for finding the number of siignificant digits after decimal for Cody, but for some reason, it shows error (semantic). Can anyone please help identify why? Thank you.
The error comes when I apply:
x = [1.000 1.04 0.22 10.1; 2.05 2.33 4.1 1000.31; 5.00010 6.429 7.492 8.0]
I tried debugging, but the error comes due to 6.429 having a ‘1’ after another 11 zeroes.
Code:
function y = find_max_sigdec(x)
stop = 0;
i = 0;
if x == fix(x)
y = 0;
else
while stop == 0
x = x*10;
i = i+1;
if x == fix(x)
y = i;
stop = 1;
end
end
end
end significant digits, rounding off MATLAB Answers — New Questions
Distributed digital subarray analysis
clc; clear all; close all;
f = 3e8;
Nx = 10; % number of antennas in subarray
Ns1 = 5;% number of sub array
h = 8; % number of virtual array between subarray
c = 3e8;
lambda = c / f;
dx = 0.42*lambda;
beta = 2 * pi / lambda;
theta = [20];
K = length(theta);
L = round(Nx / 3);
Ri = ones(1,K);
A = 1000;
SNR1 =20;
%% sub array
for Ns = 1 : Ns1
for SNR = 1: SNR1
for l = 1 :A
for m = 1: Ns
for p = 1 : Nx
pos = (m-1)*Nx+p;
P_mp(pos) = (p-(Ns*Nx+(Ns-1)*h+1)/2+(m-1)*(Nx+h));
P_mp1(m,p) = (p-(Ns*Nx+(Ns-1)*h+1)/2+(m-1)*(Nx+h));
end
end
% P_mp1 = P_mp1 + 2*(0.5-rand(Ns,Nx))*pos_var_amp;
A_mp = [];
A_mp_a = [];
E_mp_a = [];
for i = 1:Ns
E_mp(:,:,i) = exp(-1j*beta*P_mp1(i,:)’*dx*sind(theta)); % pole 값
A_mp(:,:,i) = Ri.*E_mp(:,:,i); % 측정 값
A_mp = awgn(A_mp, SNR, ‘measured’); % noise 추가
A_mp1 = sum(A_mp,2);
A_mc(:,:,i) = A_mp1(1:Nx – L + 1,:,i);
A_mr(:,:,i) = A_mp1(Nx – L + 1:Nx,:,i);
A_mk(:,:,i) = hankel(A_mc(:,:,i), A_mr(:,:,i)); % Create Hankel matrix with A_c as the first column and A_r as the last row
E_mp_a = [E_mp_a; E_mp(:,:,i)];
A_mp_a = [A_mp_a ;A_mp1(:,:,i)];
end
%% Hankel stack
Y_ss = A_mk(:,:,1);
if Ns> 1
for z = 2:Ns
Y_ss = [Y_ss ; A_mk(:,:,z)];
end
else
Y_ss = A_mk(:,:,1);
end
[U, S, V] = svd(Y_ss);
V0 = V(:, 1:K);
V1 = V0(1:end-1, :);
V2 = V0(2:end, :);
z_k = eig(pinv(V1) * V2);
find_theta_realarray_MPM(l,:)= asind((imag(log(z_k))*lambda)/(2*pi*dx))’;
rmse_real_mpm(l,:) = sort(theta) – sort(find_theta_realarray_MPM(l,:));
end
rmse_real_MPM_sum = sum(sum(abs(rmse_real_mpm).^2,1),2);
rmse_real_MPM_sum = sqrt(rmse_real_MPM_sum/(A*K));
rmse_real_MPM_sum1(SNR,Ns)= rmse_real_MPM_sum(rmse_real_MPM_sum ~= 0);
end
end
plot(1:SNR1 , rmse_real_MPM_sum1,’-d’,’LineWidth’,1.4)
legend(‘1-subarray’,’2-subarray’,’3-subarray’,’4-subarray’,’5-subarray’)
I think the RMSE should be lower as the subarray increases, but why is the RMSE reversed when the SNR is low?
plz help me…..clc; clear all; close all;
f = 3e8;
Nx = 10; % number of antennas in subarray
Ns1 = 5;% number of sub array
h = 8; % number of virtual array between subarray
c = 3e8;
lambda = c / f;
dx = 0.42*lambda;
beta = 2 * pi / lambda;
theta = [20];
K = length(theta);
L = round(Nx / 3);
Ri = ones(1,K);
A = 1000;
SNR1 =20;
%% sub array
for Ns = 1 : Ns1
for SNR = 1: SNR1
for l = 1 :A
for m = 1: Ns
for p = 1 : Nx
pos = (m-1)*Nx+p;
P_mp(pos) = (p-(Ns*Nx+(Ns-1)*h+1)/2+(m-1)*(Nx+h));
P_mp1(m,p) = (p-(Ns*Nx+(Ns-1)*h+1)/2+(m-1)*(Nx+h));
end
end
% P_mp1 = P_mp1 + 2*(0.5-rand(Ns,Nx))*pos_var_amp;
A_mp = [];
A_mp_a = [];
E_mp_a = [];
for i = 1:Ns
E_mp(:,:,i) = exp(-1j*beta*P_mp1(i,:)’*dx*sind(theta)); % pole 값
A_mp(:,:,i) = Ri.*E_mp(:,:,i); % 측정 값
A_mp = awgn(A_mp, SNR, ‘measured’); % noise 추가
A_mp1 = sum(A_mp,2);
A_mc(:,:,i) = A_mp1(1:Nx – L + 1,:,i);
A_mr(:,:,i) = A_mp1(Nx – L + 1:Nx,:,i);
A_mk(:,:,i) = hankel(A_mc(:,:,i), A_mr(:,:,i)); % Create Hankel matrix with A_c as the first column and A_r as the last row
E_mp_a = [E_mp_a; E_mp(:,:,i)];
A_mp_a = [A_mp_a ;A_mp1(:,:,i)];
end
%% Hankel stack
Y_ss = A_mk(:,:,1);
if Ns> 1
for z = 2:Ns
Y_ss = [Y_ss ; A_mk(:,:,z)];
end
else
Y_ss = A_mk(:,:,1);
end
[U, S, V] = svd(Y_ss);
V0 = V(:, 1:K);
V1 = V0(1:end-1, :);
V2 = V0(2:end, :);
z_k = eig(pinv(V1) * V2);
find_theta_realarray_MPM(l,:)= asind((imag(log(z_k))*lambda)/(2*pi*dx))’;
rmse_real_mpm(l,:) = sort(theta) – sort(find_theta_realarray_MPM(l,:));
end
rmse_real_MPM_sum = sum(sum(abs(rmse_real_mpm).^2,1),2);
rmse_real_MPM_sum = sqrt(rmse_real_MPM_sum/(A*K));
rmse_real_MPM_sum1(SNR,Ns)= rmse_real_MPM_sum(rmse_real_MPM_sum ~= 0);
end
end
plot(1:SNR1 , rmse_real_MPM_sum1,’-d’,’LineWidth’,1.4)
legend(‘1-subarray’,’2-subarray’,’3-subarray’,’4-subarray’,’5-subarray’)
I think the RMSE should be lower as the subarray increases, but why is the RMSE reversed when the SNR is low?
plz help me….. clc; clear all; close all;
f = 3e8;
Nx = 10; % number of antennas in subarray
Ns1 = 5;% number of sub array
h = 8; % number of virtual array between subarray
c = 3e8;
lambda = c / f;
dx = 0.42*lambda;
beta = 2 * pi / lambda;
theta = [20];
K = length(theta);
L = round(Nx / 3);
Ri = ones(1,K);
A = 1000;
SNR1 =20;
%% sub array
for Ns = 1 : Ns1
for SNR = 1: SNR1
for l = 1 :A
for m = 1: Ns
for p = 1 : Nx
pos = (m-1)*Nx+p;
P_mp(pos) = (p-(Ns*Nx+(Ns-1)*h+1)/2+(m-1)*(Nx+h));
P_mp1(m,p) = (p-(Ns*Nx+(Ns-1)*h+1)/2+(m-1)*(Nx+h));
end
end
% P_mp1 = P_mp1 + 2*(0.5-rand(Ns,Nx))*pos_var_amp;
A_mp = [];
A_mp_a = [];
E_mp_a = [];
for i = 1:Ns
E_mp(:,:,i) = exp(-1j*beta*P_mp1(i,:)’*dx*sind(theta)); % pole 값
A_mp(:,:,i) = Ri.*E_mp(:,:,i); % 측정 값
A_mp = awgn(A_mp, SNR, ‘measured’); % noise 추가
A_mp1 = sum(A_mp,2);
A_mc(:,:,i) = A_mp1(1:Nx – L + 1,:,i);
A_mr(:,:,i) = A_mp1(Nx – L + 1:Nx,:,i);
A_mk(:,:,i) = hankel(A_mc(:,:,i), A_mr(:,:,i)); % Create Hankel matrix with A_c as the first column and A_r as the last row
E_mp_a = [E_mp_a; E_mp(:,:,i)];
A_mp_a = [A_mp_a ;A_mp1(:,:,i)];
end
%% Hankel stack
Y_ss = A_mk(:,:,1);
if Ns> 1
for z = 2:Ns
Y_ss = [Y_ss ; A_mk(:,:,z)];
end
else
Y_ss = A_mk(:,:,1);
end
[U, S, V] = svd(Y_ss);
V0 = V(:, 1:K);
V1 = V0(1:end-1, :);
V2 = V0(2:end, :);
z_k = eig(pinv(V1) * V2);
find_theta_realarray_MPM(l,:)= asind((imag(log(z_k))*lambda)/(2*pi*dx))’;
rmse_real_mpm(l,:) = sort(theta) – sort(find_theta_realarray_MPM(l,:));
end
rmse_real_MPM_sum = sum(sum(abs(rmse_real_mpm).^2,1),2);
rmse_real_MPM_sum = sqrt(rmse_real_MPM_sum/(A*K));
rmse_real_MPM_sum1(SNR,Ns)= rmse_real_MPM_sum(rmse_real_MPM_sum ~= 0);
end
end
plot(1:SNR1 , rmse_real_MPM_sum1,’-d’,’LineWidth’,1.4)
legend(‘1-subarray’,’2-subarray’,’3-subarray’,’4-subarray’,’5-subarray’)
I think the RMSE should be lower as the subarray increases, but why is the RMSE reversed when the SNR is low?
plz help me….. ddsa, doa, hankel, svd, snr MATLAB Answers — New Questions
How can I resolve this issue when I try to get c code from simulink model?
Error:Unable to write to Simulink cache file ‘E:Laptop DataPersonalPHD DATAUWPIMyModel.slxc’ because you do not have write permission for the file.Error:Unable to write to Simulink cache file ‘E:Laptop DataPersonalPHD DATAUWPIMyModel.slxc’ because you do not have write permission for the file. Error:Unable to write to Simulink cache file ‘E:Laptop DataPersonalPHD DATAUWPIMyModel.slxc’ because you do not have write permission for the file. code generation MATLAB Answers — New Questions
find the maxima and the maximum
A conical cup is to be made from a circular piece of paper having a radius of 8 cm by cutting out a sector from the paper. Find the maximum capacity of such a cup. derivatives with full solution and drawingA conical cup is to be made from a circular piece of paper having a radius of 8 cm by cutting out a sector from the paper. Find the maximum capacity of such a cup. derivatives with full solution and drawing A conical cup is to be made from a circular piece of paper having a radius of 8 cm by cutting out a sector from the paper. Find the maximum capacity of such a cup. derivatives with full solution and drawing please finf the maxima and maximum. MATLAB Answers — New Questions
I am unable to find the battery builder app from SIMSCAPE BATTERY TRAINING
I was doing simscape battery training and I am unable to find the battery builder app
I tried to find the same from matlab environment still I cannot find it.I was doing simscape battery training and I am unable to find the battery builder app
I tried to find the same from matlab environment still I cannot find it. I was doing simscape battery training and I am unable to find the battery builder app
I tried to find the same from matlab environment still I cannot find it. #simscape battery MATLAB Answers — New Questions
I am using writetable for exporting the workspace variables into excel sheet
I have a excel template in which I export the matlab workspace variables
I am using this code –> writematrix(variables_1,’result.xlsx’,’Sheet’,1,’Range’,’B2′);
After extraction the file changes its column width which I fixed earlier as a templateI have a excel template in which I export the matlab workspace variables
I am using this code –> writematrix(variables_1,’result.xlsx’,’Sheet’,1,’Range’,’B2′);
After extraction the file changes its column width which I fixed earlier as a template I have a excel template in which I export the matlab workspace variables
I am using this code –> writematrix(variables_1,’result.xlsx’,’Sheet’,1,’Range’,’B2′);
After extraction the file changes its column width which I fixed earlier as a template exporting MATLAB Answers — New Questions
How do I retrieve the legend icons property from an existing legend?
Hi,
I have a script that automatically adjusts an existing figure’s linewidth, among other things. It does not work the same with Matlab 2016b. I have modified the script to be 2016b compatible for the most part. It updates the plot line widths but the lines in the legend are not updated. I need to add extra commands in the script to also update the lines in the legend. If I build the legend, I can retrieve the icons property and it is easy:
[~,icons] = legend(‘data 1′,’data 2’);
set(icons,’linewidth’,2);
I need to do this with an existing legend and I cannot find how to retrieve this ‘icons’ propertyHi,
I have a script that automatically adjusts an existing figure’s linewidth, among other things. It does not work the same with Matlab 2016b. I have modified the script to be 2016b compatible for the most part. It updates the plot line widths but the lines in the legend are not updated. I need to add extra commands in the script to also update the lines in the legend. If I build the legend, I can retrieve the icons property and it is easy:
[~,icons] = legend(‘data 1′,’data 2’);
set(icons,’linewidth’,2);
I need to do this with an existing legend and I cannot find how to retrieve this ‘icons’ property Hi,
I have a script that automatically adjusts an existing figure’s linewidth, among other things. It does not work the same with Matlab 2016b. I have modified the script to be 2016b compatible for the most part. It updates the plot line widths but the lines in the legend are not updated. I need to add extra commands in the script to also update the lines in the legend. If I build the legend, I can retrieve the icons property and it is easy:
[~,icons] = legend(‘data 1′,’data 2’);
set(icons,’linewidth’,2);
I need to do this with an existing legend and I cannot find how to retrieve this ‘icons’ property plot MATLAB Answers — New Questions
Simulating engagement of two helical gears
Hello,
I need to simulate two helical gears engagement. One of them is not controllable in terms of revolution. So, it has random revolution per minute. The other one can be controlled in terms of torque and revolution. With a special method, I need to engage these gears. I need to copy behavior of uncontrollable one. After their revolutions are same and steady, at this point I need to engage them.
I may use a PID controller to monitorize and copy uncontrollable one. How can I simulate that?Hello,
I need to simulate two helical gears engagement. One of them is not controllable in terms of revolution. So, it has random revolution per minute. The other one can be controlled in terms of torque and revolution. With a special method, I need to engage these gears. I need to copy behavior of uncontrollable one. After their revolutions are same and steady, at this point I need to engage them.
I may use a PID controller to monitorize and copy uncontrollable one. How can I simulate that? Hello,
I need to simulate two helical gears engagement. One of them is not controllable in terms of revolution. So, it has random revolution per minute. The other one can be controlled in terms of torque and revolution. With a special method, I need to engage these gears. I need to copy behavior of uncontrollable one. After their revolutions are same and steady, at this point I need to engage them.
I may use a PID controller to monitorize and copy uncontrollable one. How can I simulate that? helical gears, pid, simulink, engagement MATLAB Answers — New Questions
tcpclient Sending Nested Strings
I’m trying to send the string below using the Matlab tcpclient. I need to send a string that contains two strings as shown below. I tried converting the entire string below to an asciiArray using the uint8(stringBelow) function and then fwrite(t, asciiArray, ‘uint8’) but that didn’t work either.
Is there a way to send the exact composite string shown below in tcpclient?
>> writeline(t,"Unit.CommandAsText("myFile",1,"Millisecond")")
writeline(t,"Unit.CommandAsText("myFile",1,"Millisecond")")
↑
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error.
To construct matrices, use brackets instead of parentheses.I’m trying to send the string below using the Matlab tcpclient. I need to send a string that contains two strings as shown below. I tried converting the entire string below to an asciiArray using the uint8(stringBelow) function and then fwrite(t, asciiArray, ‘uint8’) but that didn’t work either.
Is there a way to send the exact composite string shown below in tcpclient?
>> writeline(t,"Unit.CommandAsText("myFile",1,"Millisecond")")
writeline(t,"Unit.CommandAsText("myFile",1,"Millisecond")")
↑
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error.
To construct matrices, use brackets instead of parentheses. I’m trying to send the string below using the Matlab tcpclient. I need to send a string that contains two strings as shown below. I tried converting the entire string below to an asciiArray using the uint8(stringBelow) function and then fwrite(t, asciiArray, ‘uint8’) but that didn’t work either.
Is there a way to send the exact composite string shown below in tcpclient?
>> writeline(t,"Unit.CommandAsText("myFile",1,"Millisecond")")
writeline(t,"Unit.CommandAsText("myFile",1,"Millisecond")")
↑
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error.
To construct matrices, use brackets instead of parentheses. tcpclient, string, nested string MATLAB Answers — New Questions
Arrowhead is turning the wrong way
The arrowhead is pointing the wrong way in the x-axis. See figure below.
Definerer alle landes forskydningsbæreevne
clc; clear; close all; clc ;
Forhold = 1/2 ;
Forhold2 = 54/228;
f_vk0 = 0.4 ; % Klæbningsbidrag [MPa]
mu_k = 0.65 ; % Friktionskoefficient
f_bt = 1.00 ; % Trækstyrke af sten [MPa]
f_k = 10.00 ; % Trykstyrke af sten [MPa]
sigma1 = -0.0:0.1:1.6 ;
sigma2 = 0.1:0.1:10.2;
sigma3 = 8.3:0.1:10 ;
sigma23 = 9.1:0.1:10 ;
Friction = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure = (f_k – sigma3) * 1/Forhold*(1/2) ;
Friction2 = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold2) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure2 = (f_k – sigma23) * 1/Forhold2*(1/2) ;
Plotter forskydningsbæreevnerne
hf = figure() ;
hold on
plot(sigma1, Friction,’–‘,’Color’,[0.4660 0.6740 0.1880],’LineWidth’,1.3)
plot(sigma2, Tension_failure,’–‘,’Color’,[0.9290 0.6940 0.1250],’LineWidth’,1.3)
plot(sigma3, Compression_failure,’–‘,’Color’,[0.4940 0.1840 0.5560],’LineWidth’,1.3)
plot(sigma1, Friction2,’LineWidth’,1.3)
plot(sigma2, Tension_failure,’Color’,[0.6350 0.0780 0.1840],’LineWidth’,1.3)
plot(sigma23, Compression_failure2,’Color’,[0.8500 0.3250 0.0980],’LineWidth’,1.3)
% Shade the area between [sigma1, Friction] and [sigma1, Friction2]
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], ‘EdgeColor’, ‘none’);
grid on;
xlim([0 12])
ylim([0 2])
% Shade the area between [sigma1, Friction] and [sigma1, Friction2]
[x0,y0,~,~] = intersections(sigma1,Friction,sigma2, Tension_failure);
ind = (sigma1<x0);
sigma1b = [sigma1(ind) x0]; % add x0 of true intersection point
Frictionp = [Friction(ind) y0]; % add y0 of true intersection point
[x1,y1,~,~] = intersections(sigma1,Friction2,sigma2, Tension_failure);
ind = (sigma1<x1);
sigma1c = [sigma1(ind) x1]; % add x1 of true intersection point
Friction2p = [Friction2(ind) y1]; % add y1 of true intersection point
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], ‘EdgeColor’, ‘none’);
tt = fill([sigma1b, fliplr(sigma1c)], [Frictionp, fliplr(Friction2p)], [0.6350 0.0780 0.1840],’FaceAlpha’,0.0,’EdgeColor’, ‘none’);
hatchfill2(tt,’single’,’HatchAngle’,-45,’HatchDensity’,90,’HatchColor’,[0.6350 0.0780 0.1840],’HatchLineWidth’,1)
% Shade the area between [sigma3, Compression_failure] and [sigma3, Compression_failure2 ]
[x01,y01,~,~] = intersections(sigma3, Compression_failure,sigma2,Tension_failure);
ind = (sigma3>x01);
sigma1b = [x01 sigma3(ind)]; % add x0 of true intersection point
Frictionp = [y01 Compression_failure(ind)]; % add y0 of true intersection point
[x11,y11,~,~] = intersections(sigma23, Compression_failure2,sigma2,Tension_failure);
ind = (sigma23>x11);
sigma1c = [x11 sigma23(ind)]; % add x1 of true intersection point
Friction2p = [y11 Compression_failure2(ind)]; % add y1 of true intersection point
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], ‘EdgeColor’, ‘none’);
tt2 = fill([sigma1b, fliplr(sigma1c)], [Frictionp, fliplr(Friction2p)], [0.6350 0.0780 0.1840], ‘EdgeColor’, ‘none’,’FaceAlpha’,0.0);
hatchfill2(tt2,’single’,’HatchAngle’,-45,’HatchDensity’,90,’HatchColor’,[0.6350 0.0780 0.1840],’HatchLineWidth’,1)
hax = gca;
hax.XDir = ‘reverse’; % flip axis direction
hax.YAxisLocation = ‘right’; % move ticks & labels to the other side
xlim([-2 12])
ylim([-0.5 2])
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [-1.5 11];
ha.Y = [0 0] ;
%Define the variable
xac = -2; %x arrow coordinate
yac = 0; %y arrow coordinate
xas = 12; %x arrow shift
yas = 0; %y arrow shift
ha = annotation(‘arrow’);
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [-1.5 11];
ha.Y = [0 0] ;
ha = annotation(‘arrow’);
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [0 0];
ha.Y = [-0.4 2] ;
% remove old box and axes
box on
set(gca,’YColor’,get(gca,’Color’))
set(gca,’XColor’,get(gca,’Color’))
set(gca, ‘FontName’, ‘Times New Roman’, ‘FontSize’, 14)
set(gca, ‘XTickLabel’, {});
set(gca, ‘YTickLabel’, {});
legend({‘Friction failure (M&M)’,’Tension failure (M&M)’,’Compression failure (M&M)’,’Friction failure (DK)’,’Tension failure (DK)’,’Compression failure (DK)’},’Location’,’northeast’,’NumColumns’,1,’Orientation’,’vertical’)The arrowhead is pointing the wrong way in the x-axis. See figure below.
Definerer alle landes forskydningsbæreevne
clc; clear; close all; clc ;
Forhold = 1/2 ;
Forhold2 = 54/228;
f_vk0 = 0.4 ; % Klæbningsbidrag [MPa]
mu_k = 0.65 ; % Friktionskoefficient
f_bt = 1.00 ; % Trækstyrke af sten [MPa]
f_k = 10.00 ; % Trykstyrke af sten [MPa]
sigma1 = -0.0:0.1:1.6 ;
sigma2 = 0.1:0.1:10.2;
sigma3 = 8.3:0.1:10 ;
sigma23 = 9.1:0.1:10 ;
Friction = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure = (f_k – sigma3) * 1/Forhold*(1/2) ;
Friction2 = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold2) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure2 = (f_k – sigma23) * 1/Forhold2*(1/2) ;
Plotter forskydningsbæreevnerne
hf = figure() ;
hold on
plot(sigma1, Friction,’–‘,’Color’,[0.4660 0.6740 0.1880],’LineWidth’,1.3)
plot(sigma2, Tension_failure,’–‘,’Color’,[0.9290 0.6940 0.1250],’LineWidth’,1.3)
plot(sigma3, Compression_failure,’–‘,’Color’,[0.4940 0.1840 0.5560],’LineWidth’,1.3)
plot(sigma1, Friction2,’LineWidth’,1.3)
plot(sigma2, Tension_failure,’Color’,[0.6350 0.0780 0.1840],’LineWidth’,1.3)
plot(sigma23, Compression_failure2,’Color’,[0.8500 0.3250 0.0980],’LineWidth’,1.3)
% Shade the area between [sigma1, Friction] and [sigma1, Friction2]
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], ‘EdgeColor’, ‘none’);
grid on;
xlim([0 12])
ylim([0 2])
% Shade the area between [sigma1, Friction] and [sigma1, Friction2]
[x0,y0,~,~] = intersections(sigma1,Friction,sigma2, Tension_failure);
ind = (sigma1<x0);
sigma1b = [sigma1(ind) x0]; % add x0 of true intersection point
Frictionp = [Friction(ind) y0]; % add y0 of true intersection point
[x1,y1,~,~] = intersections(sigma1,Friction2,sigma2, Tension_failure);
ind = (sigma1<x1);
sigma1c = [sigma1(ind) x1]; % add x1 of true intersection point
Friction2p = [Friction2(ind) y1]; % add y1 of true intersection point
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], ‘EdgeColor’, ‘none’);
tt = fill([sigma1b, fliplr(sigma1c)], [Frictionp, fliplr(Friction2p)], [0.6350 0.0780 0.1840],’FaceAlpha’,0.0,’EdgeColor’, ‘none’);
hatchfill2(tt,’single’,’HatchAngle’,-45,’HatchDensity’,90,’HatchColor’,[0.6350 0.0780 0.1840],’HatchLineWidth’,1)
% Shade the area between [sigma3, Compression_failure] and [sigma3, Compression_failure2 ]
[x01,y01,~,~] = intersections(sigma3, Compression_failure,sigma2,Tension_failure);
ind = (sigma3>x01);
sigma1b = [x01 sigma3(ind)]; % add x0 of true intersection point
Frictionp = [y01 Compression_failure(ind)]; % add y0 of true intersection point
[x11,y11,~,~] = intersections(sigma23, Compression_failure2,sigma2,Tension_failure);
ind = (sigma23>x11);
sigma1c = [x11 sigma23(ind)]; % add x1 of true intersection point
Friction2p = [y11 Compression_failure2(ind)]; % add y1 of true intersection point
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], ‘EdgeColor’, ‘none’);
tt2 = fill([sigma1b, fliplr(sigma1c)], [Frictionp, fliplr(Friction2p)], [0.6350 0.0780 0.1840], ‘EdgeColor’, ‘none’,’FaceAlpha’,0.0);
hatchfill2(tt2,’single’,’HatchAngle’,-45,’HatchDensity’,90,’HatchColor’,[0.6350 0.0780 0.1840],’HatchLineWidth’,1)
hax = gca;
hax.XDir = ‘reverse’; % flip axis direction
hax.YAxisLocation = ‘right’; % move ticks & labels to the other side
xlim([-2 12])
ylim([-0.5 2])
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [-1.5 11];
ha.Y = [0 0] ;
%Define the variable
xac = -2; %x arrow coordinate
yac = 0; %y arrow coordinate
xas = 12; %x arrow shift
yas = 0; %y arrow shift
ha = annotation(‘arrow’);
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [-1.5 11];
ha.Y = [0 0] ;
ha = annotation(‘arrow’);
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [0 0];
ha.Y = [-0.4 2] ;
% remove old box and axes
box on
set(gca,’YColor’,get(gca,’Color’))
set(gca,’XColor’,get(gca,’Color’))
set(gca, ‘FontName’, ‘Times New Roman’, ‘FontSize’, 14)
set(gca, ‘XTickLabel’, {});
set(gca, ‘YTickLabel’, {});
legend({‘Friction failure (M&M)’,’Tension failure (M&M)’,’Compression failure (M&M)’,’Friction failure (DK)’,’Tension failure (DK)’,’Compression failure (DK)’},’Location’,’northeast’,’NumColumns’,1,’Orientation’,’vertical’) The arrowhead is pointing the wrong way in the x-axis. See figure below.
Definerer alle landes forskydningsbæreevne
clc; clear; close all; clc ;
Forhold = 1/2 ;
Forhold2 = 54/228;
f_vk0 = 0.4 ; % Klæbningsbidrag [MPa]
mu_k = 0.65 ; % Friktionskoefficient
f_bt = 1.00 ; % Trækstyrke af sten [MPa]
f_k = 10.00 ; % Trykstyrke af sten [MPa]
sigma1 = -0.0:0.1:1.6 ;
sigma2 = 0.1:0.1:10.2;
sigma3 = 8.3:0.1:10 ;
sigma23 = 9.1:0.1:10 ;
Friction = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure = (f_k – sigma3) * 1/Forhold*(1/2) ;
Friction2 = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold2) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure2 = (f_k – sigma23) * 1/Forhold2*(1/2) ;
Plotter forskydningsbæreevnerne
hf = figure() ;
hold on
plot(sigma1, Friction,’–‘,’Color’,[0.4660 0.6740 0.1880],’LineWidth’,1.3)
plot(sigma2, Tension_failure,’–‘,’Color’,[0.9290 0.6940 0.1250],’LineWidth’,1.3)
plot(sigma3, Compression_failure,’–‘,’Color’,[0.4940 0.1840 0.5560],’LineWidth’,1.3)
plot(sigma1, Friction2,’LineWidth’,1.3)
plot(sigma2, Tension_failure,’Color’,[0.6350 0.0780 0.1840],’LineWidth’,1.3)
plot(sigma23, Compression_failure2,’Color’,[0.8500 0.3250 0.0980],’LineWidth’,1.3)
% Shade the area between [sigma1, Friction] and [sigma1, Friction2]
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], ‘EdgeColor’, ‘none’);
grid on;
xlim([0 12])
ylim([0 2])
% Shade the area between [sigma1, Friction] and [sigma1, Friction2]
[x0,y0,~,~] = intersections(sigma1,Friction,sigma2, Tension_failure);
ind = (sigma1<x0);
sigma1b = [sigma1(ind) x0]; % add x0 of true intersection point
Frictionp = [Friction(ind) y0]; % add y0 of true intersection point
[x1,y1,~,~] = intersections(sigma1,Friction2,sigma2, Tension_failure);
ind = (sigma1<x1);
sigma1c = [sigma1(ind) x1]; % add x1 of true intersection point
Friction2p = [Friction2(ind) y1]; % add y1 of true intersection point
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], ‘EdgeColor’, ‘none’);
tt = fill([sigma1b, fliplr(sigma1c)], [Frictionp, fliplr(Friction2p)], [0.6350 0.0780 0.1840],’FaceAlpha’,0.0,’EdgeColor’, ‘none’);
hatchfill2(tt,’single’,’HatchAngle’,-45,’HatchDensity’,90,’HatchColor’,[0.6350 0.0780 0.1840],’HatchLineWidth’,1)
% Shade the area between [sigma3, Compression_failure] and [sigma3, Compression_failure2 ]
[x01,y01,~,~] = intersections(sigma3, Compression_failure,sigma2,Tension_failure);
ind = (sigma3>x01);
sigma1b = [x01 sigma3(ind)]; % add x0 of true intersection point
Frictionp = [y01 Compression_failure(ind)]; % add y0 of true intersection point
[x11,y11,~,~] = intersections(sigma23, Compression_failure2,sigma2,Tension_failure);
ind = (sigma23>x11);
sigma1c = [x11 sigma23(ind)]; % add x1 of true intersection point
Friction2p = [y11 Compression_failure2(ind)]; % add y1 of true intersection point
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], ‘EdgeColor’, ‘none’);
tt2 = fill([sigma1b, fliplr(sigma1c)], [Frictionp, fliplr(Friction2p)], [0.6350 0.0780 0.1840], ‘EdgeColor’, ‘none’,’FaceAlpha’,0.0);
hatchfill2(tt2,’single’,’HatchAngle’,-45,’HatchDensity’,90,’HatchColor’,[0.6350 0.0780 0.1840],’HatchLineWidth’,1)
hax = gca;
hax.XDir = ‘reverse’; % flip axis direction
hax.YAxisLocation = ‘right’; % move ticks & labels to the other side
xlim([-2 12])
ylim([-0.5 2])
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [-1.5 11];
ha.Y = [0 0] ;
%Define the variable
xac = -2; %x arrow coordinate
yac = 0; %y arrow coordinate
xas = 12; %x arrow shift
yas = 0; %y arrow shift
ha = annotation(‘arrow’);
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [-1.5 11];
ha.Y = [0 0] ;
ha = annotation(‘arrow’);
ha.Parent = hf.CurrentAxes; % associate annotation with current axes
% now you can use data units
ha.X = [0 0];
ha.Y = [-0.4 2] ;
% remove old box and axes
box on
set(gca,’YColor’,get(gca,’Color’))
set(gca,’XColor’,get(gca,’Color’))
set(gca, ‘FontName’, ‘Times New Roman’, ‘FontSize’, 14)
set(gca, ‘XTickLabel’, {});
set(gca, ‘YTickLabel’, {});
legend({‘Friction failure (M&M)’,’Tension failure (M&M)’,’Compression failure (M&M)’,’Friction failure (DK)’,’Tension failure (DK)’,’Compression failure (DK)’},’Location’,’northeast’,’NumColumns’,1,’Orientation’,’vertical’) annotation(‘arrow’), ‘reverse’ MATLAB Answers — New Questions
Curve Fitting for a Rational Polynomial Model.
Dear all,
I want to find the best rational Polynomial model that can fit the data shown.
any help would be appreciated.
Data are in dB.Dear all,
I want to find the best rational Polynomial model that can fit the data shown.
any help would be appreciated.
Data are in dB. Dear all,
I want to find the best rational Polynomial model that can fit the data shown.
any help would be appreciated.
Data are in dB. curve fitting MATLAB Answers — New Questions