Tag Archives: matlab
Merging Branches with MLAPP files – Can’t merge layout changes
I have been developing some pretty complicated matlab apps, and have begun collaborating on them with a colleague, but we’ve found that the merge tool does not allow for merging the automatically generated code e.g. layouts, adding callbacks etc. I have read multiple issues posted to the community, and the closest one to an answer describes unzipping the mlapp file merging, and rezipping. This can work, but is far too risky if the way App Designer ingests data changes in the future, which would render our code unusable and unedittable.
Of course, we could export to an M file and merge there, but then we lose the ease of changing layouts in App Designer. This all seems like a lose-lose situation, is there any prospect of adding the ability to merge the whole mlapp file?I have been developing some pretty complicated matlab apps, and have begun collaborating on them with a colleague, but we’ve found that the merge tool does not allow for merging the automatically generated code e.g. layouts, adding callbacks etc. I have read multiple issues posted to the community, and the closest one to an answer describes unzipping the mlapp file merging, and rezipping. This can work, but is far too risky if the way App Designer ingests data changes in the future, which would render our code unusable and unedittable.
Of course, we could export to an M file and merge there, but then we lose the ease of changing layouts in App Designer. This all seems like a lose-lose situation, is there any prospect of adding the ability to merge the whole mlapp file? I have been developing some pretty complicated matlab apps, and have begun collaborating on them with a colleague, but we’ve found that the merge tool does not allow for merging the automatically generated code e.g. layouts, adding callbacks etc. I have read multiple issues posted to the community, and the closest one to an answer describes unzipping the mlapp file merging, and rezipping. This can work, but is far too risky if the way App Designer ingests data changes in the future, which would render our code unusable and unedittable.
Of course, we could export to an M file and merge there, but then we lose the ease of changing layouts in App Designer. This all seems like a lose-lose situation, is there any prospect of adding the ability to merge the whole mlapp file? appdesigner, git merge, mlapp MATLAB Answers — New Questions
Hopf Bifurcation diagram for 3D system
Hello I want to plot the Hopf bifurcation diagram, I have this code but I’m getting nothing other than straight lines.
% Parameters
r=3;
a=0.2;
b=2;
gamma=0.3;
m=0.92;
c=2.5;
alpha=10;
p=100.001;
q=0.01;
% Define the range of parameter values for bifurcation diagram
eta_values = linspace(0, 3, 1000); % Range of ‘eta’ values
% Arrays to store results
x_result = zeros(size(eta_values));
y_result = zeros(size(eta_values));
z_result = zeros(size(eta_values));
% Initial conditions (for detecting the Hopf bifurcation)
x0 = 1000;
y0 = 200;
z0 = 600;
% Iterate over each ‘eta’ value
for i = 1:length(eta_values)
eta = eta_values(i);
% Solve the system using ODE45
tspan = [0 1000]; % Time span for integration
odefun = @(t, Y) [r*Y(1)*(1-Y(1)/Y(3))-a*(1-m)*Y(1)*Y(2)/(1+gamma*(1-m)*Y(1));
b*(1-m)*Y(1)*Y(2)/(1+gamma*(1-m)*Y(1))-c*Y(2);
(Y(3)-alpha)*(p-Y(3))/(q+Y(3));];
[~, Y] = ode45(odefun, tspan, [x0; y0; z0]);
% Check for Hopf bifurcation (change in stability)
% Look for oscillatory behavior in the solution
if i > 1
if abs(Y(end, 1) – x_result(i-1)) > 0.01
fprintf(‘Hopf bifurcation detected at eta = %fn’, eta);
end
end
% Record the final values (or a characteristic of the solution)
x_result(i) = Y(end, 1);
y_result(i) = Y(end, 2);
z_result(i) = Y(end, 3);
end
% Plot the bifurcation diagram
figure;
plot(eta_values, x_result, ‘.k’, ‘MarkerSize’, 1);
hold on;
plot(eta_values, y_result, ‘.b’, ‘MarkerSize’, 1);
plot(eta_values, z_result, ‘.r’, ‘MarkerSize’, 1);
xlabel(‘eta’);
ylabel(‘Steady State Values’);
legend(‘x’, ‘y’, ‘z’);
title(‘Hopf Bifurcation Diagram’);
grid on;Hello I want to plot the Hopf bifurcation diagram, I have this code but I’m getting nothing other than straight lines.
% Parameters
r=3;
a=0.2;
b=2;
gamma=0.3;
m=0.92;
c=2.5;
alpha=10;
p=100.001;
q=0.01;
% Define the range of parameter values for bifurcation diagram
eta_values = linspace(0, 3, 1000); % Range of ‘eta’ values
% Arrays to store results
x_result = zeros(size(eta_values));
y_result = zeros(size(eta_values));
z_result = zeros(size(eta_values));
% Initial conditions (for detecting the Hopf bifurcation)
x0 = 1000;
y0 = 200;
z0 = 600;
% Iterate over each ‘eta’ value
for i = 1:length(eta_values)
eta = eta_values(i);
% Solve the system using ODE45
tspan = [0 1000]; % Time span for integration
odefun = @(t, Y) [r*Y(1)*(1-Y(1)/Y(3))-a*(1-m)*Y(1)*Y(2)/(1+gamma*(1-m)*Y(1));
b*(1-m)*Y(1)*Y(2)/(1+gamma*(1-m)*Y(1))-c*Y(2);
(Y(3)-alpha)*(p-Y(3))/(q+Y(3));];
[~, Y] = ode45(odefun, tspan, [x0; y0; z0]);
% Check for Hopf bifurcation (change in stability)
% Look for oscillatory behavior in the solution
if i > 1
if abs(Y(end, 1) – x_result(i-1)) > 0.01
fprintf(‘Hopf bifurcation detected at eta = %fn’, eta);
end
end
% Record the final values (or a characteristic of the solution)
x_result(i) = Y(end, 1);
y_result(i) = Y(end, 2);
z_result(i) = Y(end, 3);
end
% Plot the bifurcation diagram
figure;
plot(eta_values, x_result, ‘.k’, ‘MarkerSize’, 1);
hold on;
plot(eta_values, y_result, ‘.b’, ‘MarkerSize’, 1);
plot(eta_values, z_result, ‘.r’, ‘MarkerSize’, 1);
xlabel(‘eta’);
ylabel(‘Steady State Values’);
legend(‘x’, ‘y’, ‘z’);
title(‘Hopf Bifurcation Diagram’);
grid on; Hello I want to plot the Hopf bifurcation diagram, I have this code but I’m getting nothing other than straight lines.
% Parameters
r=3;
a=0.2;
b=2;
gamma=0.3;
m=0.92;
c=2.5;
alpha=10;
p=100.001;
q=0.01;
% Define the range of parameter values for bifurcation diagram
eta_values = linspace(0, 3, 1000); % Range of ‘eta’ values
% Arrays to store results
x_result = zeros(size(eta_values));
y_result = zeros(size(eta_values));
z_result = zeros(size(eta_values));
% Initial conditions (for detecting the Hopf bifurcation)
x0 = 1000;
y0 = 200;
z0 = 600;
% Iterate over each ‘eta’ value
for i = 1:length(eta_values)
eta = eta_values(i);
% Solve the system using ODE45
tspan = [0 1000]; % Time span for integration
odefun = @(t, Y) [r*Y(1)*(1-Y(1)/Y(3))-a*(1-m)*Y(1)*Y(2)/(1+gamma*(1-m)*Y(1));
b*(1-m)*Y(1)*Y(2)/(1+gamma*(1-m)*Y(1))-c*Y(2);
(Y(3)-alpha)*(p-Y(3))/(q+Y(3));];
[~, Y] = ode45(odefun, tspan, [x0; y0; z0]);
% Check for Hopf bifurcation (change in stability)
% Look for oscillatory behavior in the solution
if i > 1
if abs(Y(end, 1) – x_result(i-1)) > 0.01
fprintf(‘Hopf bifurcation detected at eta = %fn’, eta);
end
end
% Record the final values (or a characteristic of the solution)
x_result(i) = Y(end, 1);
y_result(i) = Y(end, 2);
z_result(i) = Y(end, 3);
end
% Plot the bifurcation diagram
figure;
plot(eta_values, x_result, ‘.k’, ‘MarkerSize’, 1);
hold on;
plot(eta_values, y_result, ‘.b’, ‘MarkerSize’, 1);
plot(eta_values, z_result, ‘.r’, ‘MarkerSize’, 1);
xlabel(‘eta’);
ylabel(‘Steady State Values’);
legend(‘x’, ‘y’, ‘z’);
title(‘Hopf Bifurcation Diagram’);
grid on; hopf, bifurcation MATLAB Answers — New Questions
How to find angle in equation?
I want to find omega value in the equation.
can i anybody tell me how to solve this equation.I want to find omega value in the equation.
can i anybody tell me how to solve this equation. I want to find omega value in the equation.
can i anybody tell me how to solve this equation. find angle MATLAB Answers — New Questions
Facing Issue with Simulink Bus Creator Block
"Error that signal name doesnt match specified at input port of Bus Creator"
I have created a small simulink model and added bus to it , if I keep the names which are present by default in the bus creator and bus selector, I dont get any error, however if I try to change the names I get error that signal name doesnt match specified at input port of Bus Creator. Please see the images below.
https://imgur.com/a/N6e3FB1"Error that signal name doesnt match specified at input port of Bus Creator"
I have created a small simulink model and added bus to it , if I keep the names which are present by default in the bus creator and bus selector, I dont get any error, however if I try to change the names I get error that signal name doesnt match specified at input port of Bus Creator. Please see the images below.
https://imgur.com/a/N6e3FB1 "Error that signal name doesnt match specified at input port of Bus Creator"
I have created a small simulink model and added bus to it , if I keep the names which are present by default in the bus creator and bus selector, I dont get any error, however if I try to change the names I get error that signal name doesnt match specified at input port of Bus Creator. Please see the images below.
https://imgur.com/a/N6e3FB1 simulink, matlab MATLAB Answers — New Questions
Fast conversion of 2 matrices to 1 complex matrix
Hi,
After reading my data from an external binary file, I have a 3 dimensional array representing one complex matrix, like this:
A(1,:,:) = rand(10); % real part
A(2,:,:) = rand(10); % imaginary part
I need to convert that into a complex matrix, e.g.
A = complex(A(1,:,:), A(2,:,:));
But this is rather slow. As far as I have been able to find out, Matlab stores complex matrices internally as two matrices, one for the real and one for the imaginary part. This is about the same as my original 3-dimensional matrix — and should be quite fast! My assumption therefore is that Matlab uses a temporary variable which of course needs to be allocated, resulting in slow code.
Is it possible to make Matlab do this conversion without allocating more memory? Maybe just setting the ‘complex’ attribute to A… It might be possible using mex files, but I never used them before, and I would prefer a ‘pure’ Matlab solution.
Any comments, hints or keywords I can google for are welcome!
Regards ArgonHi,
After reading my data from an external binary file, I have a 3 dimensional array representing one complex matrix, like this:
A(1,:,:) = rand(10); % real part
A(2,:,:) = rand(10); % imaginary part
I need to convert that into a complex matrix, e.g.
A = complex(A(1,:,:), A(2,:,:));
But this is rather slow. As far as I have been able to find out, Matlab stores complex matrices internally as two matrices, one for the real and one for the imaginary part. This is about the same as my original 3-dimensional matrix — and should be quite fast! My assumption therefore is that Matlab uses a temporary variable which of course needs to be allocated, resulting in slow code.
Is it possible to make Matlab do this conversion without allocating more memory? Maybe just setting the ‘complex’ attribute to A… It might be possible using mex files, but I never used them before, and I would prefer a ‘pure’ Matlab solution.
Any comments, hints or keywords I can google for are welcome!
Regards Argon Hi,
After reading my data from an external binary file, I have a 3 dimensional array representing one complex matrix, like this:
A(1,:,:) = rand(10); % real part
A(2,:,:) = rand(10); % imaginary part
I need to convert that into a complex matrix, e.g.
A = complex(A(1,:,:), A(2,:,:));
But this is rather slow. As far as I have been able to find out, Matlab stores complex matrices internally as two matrices, one for the real and one for the imaginary part. This is about the same as my original 3-dimensional matrix — and should be quite fast! My assumption therefore is that Matlab uses a temporary variable which of course needs to be allocated, resulting in slow code.
Is it possible to make Matlab do this conversion without allocating more memory? Maybe just setting the ‘complex’ attribute to A… It might be possible using mex files, but I never used them before, and I would prefer a ‘pure’ Matlab solution.
Any comments, hints or keywords I can google for are welcome!
Regards Argon complex, memory allocation MATLAB Answers — New Questions
Using the Asynchronous machine SI Units in Delta connection is possible ?
Hello, I am trying to simulate the operation of a three-phase induction machine using Matlab Simulink, but I need the stator connection to be in delta configuration. The motor available in Matlab Simulink is pre-configured in wye (star), and I am unable to change it. I tried using the Phase Permute, but it doesn’t connect with the objects in the current versions of Matlab. Does anyone have any idea how I can change the stator connection from Y to Delta?Hello, I am trying to simulate the operation of a three-phase induction machine using Matlab Simulink, but I need the stator connection to be in delta configuration. The motor available in Matlab Simulink is pre-configured in wye (star), and I am unable to change it. I tried using the Phase Permute, but it doesn’t connect with the objects in the current versions of Matlab. Does anyone have any idea how I can change the stator connection from Y to Delta? Hello, I am trying to simulate the operation of a three-phase induction machine using Matlab Simulink, but I need the stator connection to be in delta configuration. The motor available in Matlab Simulink is pre-configured in wye (star), and I am unable to change it. I tried using the Phase Permute, but it doesn’t connect with the objects in the current versions of Matlab. Does anyone have any idea how I can change the stator connection from Y to Delta? asynchronous machine si units, delta connection MATLAB Answers — New Questions
Isolating one Texture from LBP
I’m trying to use local binary patterns to categorize/sort images into five categories. I’d like to be able to look at what textures are common in images from each category/what the numbers with the highest frequency in the LBP histograms relate to. I’m using extractLBPFeatures to get the LBP data.
Ideally, I’m aiming for something like this image above, however the same textures/features (edge, flat, corner) don’t apply well to my images.I’m trying to use local binary patterns to categorize/sort images into five categories. I’d like to be able to look at what textures are common in images from each category/what the numbers with the highest frequency in the LBP histograms relate to. I’m using extractLBPFeatures to get the LBP data.
Ideally, I’m aiming for something like this image above, however the same textures/features (edge, flat, corner) don’t apply well to my images. I’m trying to use local binary patterns to categorize/sort images into five categories. I’d like to be able to look at what textures are common in images from each category/what the numbers with the highest frequency in the LBP histograms relate to. I’m using extractLBPFeatures to get the LBP data.
Ideally, I’m aiming for something like this image above, however the same textures/features (edge, flat, corner) don’t apply well to my images. lbp, texture, image analysis, localbinarypatterns MATLAB Answers — New Questions
Matrix is singular to working precision.
I’m getting the error "Matrix is singular to working precision." I’m not sure what is wrong with my code but I need to not get zeros for my Total Stiffness Matrix, Nodal Forces, and Nodal Dispalcements. What should I do?
E = 200e9 * ones(2,1);
L = 2 * ones(2,1);
I = 3e-4 * ones(2,1);
kb = E.*I./L.^3;
q = 2e3; %—Positive for -y direction
f0 = q*[-L(2)/2;-L(2)^2/12;-L(2)/2;L(2)^2/12];
K = beam_stiffness(kb,L);
K(4:6,4:6)
d_part = K(4:6,4:6)f0(2:end);
d = [0;0;0;d_part];
f_eff = K * d;
f = f_eff – [0;0;-q*L(2)/2;-q*L(2)^2/12;-q*L(2)/2;q*L(2)^2/12];
t = zeros(size(L));
for cnt=1:length(L)
n{cnt} (1) = cnt;
n{cnt} (2) = cnt + 1;
end
function result = beam_stiffness(kb,l)
if ~(length(kb)==length(l))
error(‘Base stiffness and length arrays must have equal number of elements.’);
end
num_elem = length(kb);
num_node = num_elem + 1;
ke = zeros(4,4,length(kb));
for cnt=1:num_elem
ke(:,:,cnt) = kb(cnt) * [12 6*l(cnt) -12 6*l(cnt);
6*l(cnt) 4*l(cnt)^2 -6*l(cnt) 2*l(cnt)^2;
-12 -6*l(cnt) 12 -6*l(cnt);
6*l(cnt) 2*l(cnt)^2 -6*l(cnt) 4*l(cnt)^2];
end
K = zeros(2*num_node,2*num_node);
for cnt=1:num_elem
K(2*cnt-1:2*cnt+2,2*cnt-1:2*cnt+2) – K(2*cnt-1:2*cnt+2,2*cnt-1:2*cnt+2) + …
ke(:,:,cnt);
end
result = K;
endI’m getting the error "Matrix is singular to working precision." I’m not sure what is wrong with my code but I need to not get zeros for my Total Stiffness Matrix, Nodal Forces, and Nodal Dispalcements. What should I do?
E = 200e9 * ones(2,1);
L = 2 * ones(2,1);
I = 3e-4 * ones(2,1);
kb = E.*I./L.^3;
q = 2e3; %—Positive for -y direction
f0 = q*[-L(2)/2;-L(2)^2/12;-L(2)/2;L(2)^2/12];
K = beam_stiffness(kb,L);
K(4:6,4:6)
d_part = K(4:6,4:6)f0(2:end);
d = [0;0;0;d_part];
f_eff = K * d;
f = f_eff – [0;0;-q*L(2)/2;-q*L(2)^2/12;-q*L(2)/2;q*L(2)^2/12];
t = zeros(size(L));
for cnt=1:length(L)
n{cnt} (1) = cnt;
n{cnt} (2) = cnt + 1;
end
function result = beam_stiffness(kb,l)
if ~(length(kb)==length(l))
error(‘Base stiffness and length arrays must have equal number of elements.’);
end
num_elem = length(kb);
num_node = num_elem + 1;
ke = zeros(4,4,length(kb));
for cnt=1:num_elem
ke(:,:,cnt) = kb(cnt) * [12 6*l(cnt) -12 6*l(cnt);
6*l(cnt) 4*l(cnt)^2 -6*l(cnt) 2*l(cnt)^2;
-12 -6*l(cnt) 12 -6*l(cnt);
6*l(cnt) 2*l(cnt)^2 -6*l(cnt) 4*l(cnt)^2];
end
K = zeros(2*num_node,2*num_node);
for cnt=1:num_elem
K(2*cnt-1:2*cnt+2,2*cnt-1:2*cnt+2) – K(2*cnt-1:2*cnt+2,2*cnt-1:2*cnt+2) + …
ke(:,:,cnt);
end
result = K;
end I’m getting the error "Matrix is singular to working precision." I’m not sure what is wrong with my code but I need to not get zeros for my Total Stiffness Matrix, Nodal Forces, and Nodal Dispalcements. What should I do?
E = 200e9 * ones(2,1);
L = 2 * ones(2,1);
I = 3e-4 * ones(2,1);
kb = E.*I./L.^3;
q = 2e3; %—Positive for -y direction
f0 = q*[-L(2)/2;-L(2)^2/12;-L(2)/2;L(2)^2/12];
K = beam_stiffness(kb,L);
K(4:6,4:6)
d_part = K(4:6,4:6)f0(2:end);
d = [0;0;0;d_part];
f_eff = K * d;
f = f_eff – [0;0;-q*L(2)/2;-q*L(2)^2/12;-q*L(2)/2;q*L(2)^2/12];
t = zeros(size(L));
for cnt=1:length(L)
n{cnt} (1) = cnt;
n{cnt} (2) = cnt + 1;
end
function result = beam_stiffness(kb,l)
if ~(length(kb)==length(l))
error(‘Base stiffness and length arrays must have equal number of elements.’);
end
num_elem = length(kb);
num_node = num_elem + 1;
ke = zeros(4,4,length(kb));
for cnt=1:num_elem
ke(:,:,cnt) = kb(cnt) * [12 6*l(cnt) -12 6*l(cnt);
6*l(cnt) 4*l(cnt)^2 -6*l(cnt) 2*l(cnt)^2;
-12 -6*l(cnt) 12 -6*l(cnt);
6*l(cnt) 2*l(cnt)^2 -6*l(cnt) 4*l(cnt)^2];
end
K = zeros(2*num_node,2*num_node);
for cnt=1:num_elem
K(2*cnt-1:2*cnt+2,2*cnt-1:2*cnt+2) – K(2*cnt-1:2*cnt+2,2*cnt-1:2*cnt+2) + …
ke(:,:,cnt);
end
result = K;
end matrix MATLAB Answers — New Questions
Loop data in both x and y direction, and do linear fit of each y at each x
I have two matrice. matrix 1 (time points) is 96 by 1 (row is time); matrix 2 is 96 by 150. matrix 2 is the readout data points (row) at each time point of 150 individual elements (column). I want to fit each data point (matrix 2, row) at each time point (matrix 1) to y=ax+b and so on until the last time point. The result is ideally to be a slope matrix (96 by 150). I have very limited clue on how to do it, appreaciate if anyone know how to do this.I have two matrice. matrix 1 (time points) is 96 by 1 (row is time); matrix 2 is 96 by 150. matrix 2 is the readout data points (row) at each time point of 150 individual elements (column). I want to fit each data point (matrix 2, row) at each time point (matrix 1) to y=ax+b and so on until the last time point. The result is ideally to be a slope matrix (96 by 150). I have very limited clue on how to do it, appreaciate if anyone know how to do this. I have two matrice. matrix 1 (time points) is 96 by 1 (row is time); matrix 2 is 96 by 150. matrix 2 is the readout data points (row) at each time point of 150 individual elements (column). I want to fit each data point (matrix 2, row) at each time point (matrix 1) to y=ax+b and so on until the last time point. The result is ideally to be a slope matrix (96 by 150). I have very limited clue on how to do it, appreaciate if anyone know how to do this. loop, matlab, curve fitting MATLAB Answers — New Questions
changing the scale on the Y axis
Good evening sir
Sir I need -1 to 1 on Y-axis but i got this on X-axis. Now I request you please help me how to getting -1 to 1 on Y-axis. I attached my code and graph relating to my code.
Code:
xmesh1 = linspace(-1,0,10);
xmesh2 = linspace(0,1,10);
xmesh = [xmesh1,xmesh2];
yinit = [0 1 0 1 0 1 0 1];
init = bvpinit(xmesh,yinit);
sol = bvp5c(@f, @bc, init);
plot(sol.x,sol.y(2,:),’b-o’,sol.x,sol.y(3 ,:),’r-o’)
%line([1 1], [0 1], ‘Color’, ‘k’)
% legend(‘y1′,’y3’)
% % title(‘A Three-Point BVP Solved with bvp5c’)
% xlabel({‘x’, ‘lambda = 2, kappa = 5’})
% ylabel(‘v(x) and C(x)’)
hold on
function dydx = f(x,y,region) % equations being solved
W=1;alpha=1;M=2;k1=1;k2=1;k3=1;k4=1;k=1; Ps=1;Po=1;R1=0;R2=2;
omega=1;
us = y(1);
usy = y(2);
uo = y(3);
u0y = y(4);
thetas = y(5);
thetasy = y(6);
thetao = y(7);
thetaoy = y(8);
dydx = zeros(8,1);
switch region
case 1 % x in [-1 0]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k2)*us – alpha*Ps*R2;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R2)*uo – alpha*Po*R2; % 1/K2 ?
dydx(5) = thetasy+thetas;
dydx(6) = k1*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k3*thetasy*thetaoy;
case 2 % x in [0 1]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k1)*us – Ps*R1;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R1)*uo – Po*R1;
dydx(5) = thetasy;
dydx(6) = k2*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k4*thetasy*thetaoy;
end
end
function res = bc(YL,YR)
mu1=1; mu2=1; k1=1; k2=1;
res = [YL(1,1)
YL(3,1)
YL(5,1)
YL(7,1)
YR(1,2)-1
YR(3,2)-1
YR(5,2)-1
YR(7,2)
YR(1,1)-YL(1,2)
mu1*YR(2,1)-mu2*YL(2,2)
YR(3,1)-YL(3,2)
mu1*YR(4,1)-mu2*YL(4,2)
YR(5,1)-YL(5,2)
k1*YR(6,1)-k2*YL(6,2)
YR(7,1)-YL(7,2)
k1*YR(8,1)-k2*YL(8,2)];
end
The graph relating to code is
But I need the -1 to 1 range on Y-axis like the following graph:Good evening sir
Sir I need -1 to 1 on Y-axis but i got this on X-axis. Now I request you please help me how to getting -1 to 1 on Y-axis. I attached my code and graph relating to my code.
Code:
xmesh1 = linspace(-1,0,10);
xmesh2 = linspace(0,1,10);
xmesh = [xmesh1,xmesh2];
yinit = [0 1 0 1 0 1 0 1];
init = bvpinit(xmesh,yinit);
sol = bvp5c(@f, @bc, init);
plot(sol.x,sol.y(2,:),’b-o’,sol.x,sol.y(3 ,:),’r-o’)
%line([1 1], [0 1], ‘Color’, ‘k’)
% legend(‘y1′,’y3’)
% % title(‘A Three-Point BVP Solved with bvp5c’)
% xlabel({‘x’, ‘lambda = 2, kappa = 5’})
% ylabel(‘v(x) and C(x)’)
hold on
function dydx = f(x,y,region) % equations being solved
W=1;alpha=1;M=2;k1=1;k2=1;k3=1;k4=1;k=1; Ps=1;Po=1;R1=0;R2=2;
omega=1;
us = y(1);
usy = y(2);
uo = y(3);
u0y = y(4);
thetas = y(5);
thetasy = y(6);
thetao = y(7);
thetaoy = y(8);
dydx = zeros(8,1);
switch region
case 1 % x in [-1 0]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k2)*us – alpha*Ps*R2;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R2)*uo – alpha*Po*R2; % 1/K2 ?
dydx(5) = thetasy+thetas;
dydx(6) = k1*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k3*thetasy*thetaoy;
case 2 % x in [0 1]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k1)*us – Ps*R1;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R1)*uo – Po*R1;
dydx(5) = thetasy;
dydx(6) = k2*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k4*thetasy*thetaoy;
end
end
function res = bc(YL,YR)
mu1=1; mu2=1; k1=1; k2=1;
res = [YL(1,1)
YL(3,1)
YL(5,1)
YL(7,1)
YR(1,2)-1
YR(3,2)-1
YR(5,2)-1
YR(7,2)
YR(1,1)-YL(1,2)
mu1*YR(2,1)-mu2*YL(2,2)
YR(3,1)-YL(3,2)
mu1*YR(4,1)-mu2*YL(4,2)
YR(5,1)-YL(5,2)
k1*YR(6,1)-k2*YL(6,2)
YR(7,1)-YL(7,2)
k1*YR(8,1)-k2*YL(8,2)];
end
The graph relating to code is
But I need the -1 to 1 range on Y-axis like the following graph: Good evening sir
Sir I need -1 to 1 on Y-axis but i got this on X-axis. Now I request you please help me how to getting -1 to 1 on Y-axis. I attached my code and graph relating to my code.
Code:
xmesh1 = linspace(-1,0,10);
xmesh2 = linspace(0,1,10);
xmesh = [xmesh1,xmesh2];
yinit = [0 1 0 1 0 1 0 1];
init = bvpinit(xmesh,yinit);
sol = bvp5c(@f, @bc, init);
plot(sol.x,sol.y(2,:),’b-o’,sol.x,sol.y(3 ,:),’r-o’)
%line([1 1], [0 1], ‘Color’, ‘k’)
% legend(‘y1′,’y3’)
% % title(‘A Three-Point BVP Solved with bvp5c’)
% xlabel({‘x’, ‘lambda = 2, kappa = 5’})
% ylabel(‘v(x) and C(x)’)
hold on
function dydx = f(x,y,region) % equations being solved
W=1;alpha=1;M=2;k1=1;k2=1;k3=1;k4=1;k=1; Ps=1;Po=1;R1=0;R2=2;
omega=1;
us = y(1);
usy = y(2);
uo = y(3);
u0y = y(4);
thetas = y(5);
thetasy = y(6);
thetao = y(7);
thetaoy = y(8);
dydx = zeros(8,1);
switch region
case 1 % x in [-1 0]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k2)*us – alpha*Ps*R2;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R2)*uo – alpha*Po*R2; % 1/K2 ?
dydx(5) = thetasy+thetas;
dydx(6) = k1*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k3*thetasy*thetaoy;
case 2 % x in [0 1]
dydx(1) = usy;
dydx(2) = (M^2 + 1/k1)*us – Ps*R1;
dydx(3) = u0y;
dydx(4) = (M^2 + 1/k1 + 1i*omega*R1)*uo – Po*R1;
dydx(5) = thetasy;
dydx(6) = k2*usy^2;
dydx(7) = thetaoy;
dydx(8) = k*thetao – k4*thetasy*thetaoy;
end
end
function res = bc(YL,YR)
mu1=1; mu2=1; k1=1; k2=1;
res = [YL(1,1)
YL(3,1)
YL(5,1)
YL(7,1)
YR(1,2)-1
YR(3,2)-1
YR(5,2)-1
YR(7,2)
YR(1,1)-YL(1,2)
mu1*YR(2,1)-mu2*YL(2,2)
YR(3,1)-YL(3,2)
mu1*YR(4,1)-mu2*YL(4,2)
YR(5,1)-YL(5,2)
k1*YR(6,1)-k2*YL(6,2)
YR(7,1)-YL(7,2)
k1*YR(8,1)-k2*YL(8,2)];
end
The graph relating to code is
But I need the -1 to 1 range on Y-axis like the following graph: graph MATLAB Answers — New Questions
“tighter” tile spacing and uniform tile height using tiledlayout?
I have three .png images (.fig also available) that I would like to combine using a tiledlayout.
I want the combined image to have a 1×3 layout and have a much tighter spacing than the "tight" option is giving, but I don’t want no spacing.
Adittionally, I want all three images in the combined image to have the same height.
The code I am using is shown below:
% Create tiled layout
tiledlayout(1,3,’TileSpacing’,’tight’,’Padding’,’none’);
% Image A
nexttile
ImageA = imread(‘image-a.png’);
imshow(ImageA)
% Image B
nexttile
ImageB = imread(‘image-b.png’);
imshow(ImageB)
% Image C
nexttile
ImageC = imread(‘image-c.png’);
imshow(ImageC)
% Save combined image
exportgraphics(gcf,’image-combined.png’)
With the following output:
Clearly, the spacing is not very tight, I would like it approximately 1/3 of the current amount.
It is also clear that the images all have different heights. Ideally, they would all have the same height, but retain their original aspect ratios.I have three .png images (.fig also available) that I would like to combine using a tiledlayout.
I want the combined image to have a 1×3 layout and have a much tighter spacing than the "tight" option is giving, but I don’t want no spacing.
Adittionally, I want all three images in the combined image to have the same height.
The code I am using is shown below:
% Create tiled layout
tiledlayout(1,3,’TileSpacing’,’tight’,’Padding’,’none’);
% Image A
nexttile
ImageA = imread(‘image-a.png’);
imshow(ImageA)
% Image B
nexttile
ImageB = imread(‘image-b.png’);
imshow(ImageB)
% Image C
nexttile
ImageC = imread(‘image-c.png’);
imshow(ImageC)
% Save combined image
exportgraphics(gcf,’image-combined.png’)
With the following output:
Clearly, the spacing is not very tight, I would like it approximately 1/3 of the current amount.
It is also clear that the images all have different heights. Ideally, they would all have the same height, but retain their original aspect ratios. I have three .png images (.fig also available) that I would like to combine using a tiledlayout.
I want the combined image to have a 1×3 layout and have a much tighter spacing than the "tight" option is giving, but I don’t want no spacing.
Adittionally, I want all three images in the combined image to have the same height.
The code I am using is shown below:
% Create tiled layout
tiledlayout(1,3,’TileSpacing’,’tight’,’Padding’,’none’);
% Image A
nexttile
ImageA = imread(‘image-a.png’);
imshow(ImageA)
% Image B
nexttile
ImageB = imread(‘image-b.png’);
imshow(ImageB)
% Image C
nexttile
ImageC = imread(‘image-c.png’);
imshow(ImageC)
% Save combined image
exportgraphics(gcf,’image-combined.png’)
With the following output:
Clearly, the spacing is not very tight, I would like it approximately 1/3 of the current amount.
It is also clear that the images all have different heights. Ideally, they would all have the same height, but retain their original aspect ratios. subplot, tiledlayout, figure MATLAB Answers — New Questions
FM broadcasting Transmitter and Receiver using Adalm Pluto
I am new to SDR and communication systems and I am trying to transmit an mp3 file via FM broadcasting transmitter and then receive it using adalm Pluto. I have connected the Transmitter and receiver together with the cable but when i receive the signal and demodulate it, I only get noise.
This is the block diagram I am using.
And These are my parameters for each block
Thank youI am new to SDR and communication systems and I am trying to transmit an mp3 file via FM broadcasting transmitter and then receive it using adalm Pluto. I have connected the Transmitter and receiver together with the cable but when i receive the signal and demodulate it, I only get noise.
This is the block diagram I am using.
And These are my parameters for each block
Thank you I am new to SDR and communication systems and I am trying to transmit an mp3 file via FM broadcasting transmitter and then receive it using adalm Pluto. I have connected the Transmitter and receiver together with the cable but when i receive the signal and demodulate it, I only get noise.
This is the block diagram I am using.
And These are my parameters for each block
Thank you pluto, fm broadcasting MATLAB Answers — New Questions
How can I apply data in function?
wanna show data in function as val = ~ How can I do this….wanna show data in function as val = ~ How can I do this…. wanna show data in function as val = ~ How can I do this…. #matlab MATLAB Answers — New Questions
Read a userid file and search for userid.json in directory and then search json file
I know what I need to do, just having a hard to getting it going.
I have this userid.txt file that contains the only user files that I want to consider. If the userid say, 1821407, matches a json file within the directory, for example 1821407.json (all json files have this format), I want to check in the file for some data. I’m thinking I can do the search within the json file part. How do I use Matlab to perform the userid comparison within the directory?I know what I need to do, just having a hard to getting it going.
I have this userid.txt file that contains the only user files that I want to consider. If the userid say, 1821407, matches a json file within the directory, for example 1821407.json (all json files have this format), I want to check in the file for some data. I’m thinking I can do the search within the json file part. How do I use Matlab to perform the userid comparison within the directory? I know what I need to do, just having a hard to getting it going.
I have this userid.txt file that contains the only user files that I want to consider. If the userid say, 1821407, matches a json file within the directory, for example 1821407.json (all json files have this format), I want to check in the file for some data. I’m thinking I can do the search within the json file part. How do I use Matlab to perform the userid comparison within the directory? directory search, json files MATLAB Answers — New Questions
Struct array with differently sized fields as parameter data for Simulink simulation
I have CAD files of 3D shapes in obj format. In this format, the shapes are made up of a number of triangles. Using a MATLAB function, I can import data of these shapes into MATLAB. The data are made up of the coordinates of the triangles’ vertices, the vector of the triangles’ surface normals and the triangles’ area. Using the function on one of the files looks like this:
[vertices, surfaceNormals, areas] = objImport(‘some3dShape.obj’);
Now, vertices is a double array of size 3x3xN. N is the number of triangles of this shape and there are three vertices per triangle and each vertex is described by three coordinates. Consequently, surfaceNormals is of size 3xN and areas is of size 1xN.
I want to use these data of multiple shapes in a Simulink simulation. So, I thought, that I could store the data of all shapes nicely in a struct array in the MATLAB workspace before starting the simulation.
shapes = struct();
[shapes(1).vertices, shapes(1).surfaceNormals, shapes(1).areas] = objImport(‘shape1.obj’);
[shapes(2).vertices, shapes(2).surfaceNormals, shapes(2).areas] = objImport(‘shape2.obj’);
[shapes(3).vertices, shapes(3).surfaceNormals, shapes(3).areas] = objImport(‘shape3.obj’);
A MATLAB function block within the Simulink simulation could then access the shapes struct array from the MATLAB workspace as parameter data.
At least, that was the idea. MATLAB can deal with this kind of struct array. However, Simulink throws the error message "Mixed field types in structure arrays are not supported". This only works if all fields with the same name in the struct array have the same size. So, if shapes(1).vertices had size 3x3x100, then shapes(2).vertices would also have to have this size, meaning all shapes must be made up of the same number of triangles.
I am assuming that this error is the same one as described here. So, I am assuming this has to do with the compilation of the simulation into C code.
Possible Solutions I came up with
Create a new struct for every shape (shape1, shape2, …).
Pad the smaller arrays with zeros and add another field that keeps track of the actual amount of triangles per shape.
Solution 1 has the drawback that I would have to adapt my simulation every time I use a different number of shapes. I wanted to use the struct array so that the MATLAB function block can simply iterate over all struct array items in order to keep the simulation as generic as possible.
Solution 2 seems inefficient. If one of the shapes has a lot of triangles, then the struct array items of the other shapes would also have use up the same amount of memory even if they actually had a lot less triangles.
Are there any other solutions? Is there maybe some pointer-based alternative to struct arrays that does not store the actual data but just a pointer to it? That way the fields would all have the same size (that of a pointer).I have CAD files of 3D shapes in obj format. In this format, the shapes are made up of a number of triangles. Using a MATLAB function, I can import data of these shapes into MATLAB. The data are made up of the coordinates of the triangles’ vertices, the vector of the triangles’ surface normals and the triangles’ area. Using the function on one of the files looks like this:
[vertices, surfaceNormals, areas] = objImport(‘some3dShape.obj’);
Now, vertices is a double array of size 3x3xN. N is the number of triangles of this shape and there are three vertices per triangle and each vertex is described by three coordinates. Consequently, surfaceNormals is of size 3xN and areas is of size 1xN.
I want to use these data of multiple shapes in a Simulink simulation. So, I thought, that I could store the data of all shapes nicely in a struct array in the MATLAB workspace before starting the simulation.
shapes = struct();
[shapes(1).vertices, shapes(1).surfaceNormals, shapes(1).areas] = objImport(‘shape1.obj’);
[shapes(2).vertices, shapes(2).surfaceNormals, shapes(2).areas] = objImport(‘shape2.obj’);
[shapes(3).vertices, shapes(3).surfaceNormals, shapes(3).areas] = objImport(‘shape3.obj’);
A MATLAB function block within the Simulink simulation could then access the shapes struct array from the MATLAB workspace as parameter data.
At least, that was the idea. MATLAB can deal with this kind of struct array. However, Simulink throws the error message "Mixed field types in structure arrays are not supported". This only works if all fields with the same name in the struct array have the same size. So, if shapes(1).vertices had size 3x3x100, then shapes(2).vertices would also have to have this size, meaning all shapes must be made up of the same number of triangles.
I am assuming that this error is the same one as described here. So, I am assuming this has to do with the compilation of the simulation into C code.
Possible Solutions I came up with
Create a new struct for every shape (shape1, shape2, …).
Pad the smaller arrays with zeros and add another field that keeps track of the actual amount of triangles per shape.
Solution 1 has the drawback that I would have to adapt my simulation every time I use a different number of shapes. I wanted to use the struct array so that the MATLAB function block can simply iterate over all struct array items in order to keep the simulation as generic as possible.
Solution 2 seems inefficient. If one of the shapes has a lot of triangles, then the struct array items of the other shapes would also have use up the same amount of memory even if they actually had a lot less triangles.
Are there any other solutions? Is there maybe some pointer-based alternative to struct arrays that does not store the actual data but just a pointer to it? That way the fields would all have the same size (that of a pointer). I have CAD files of 3D shapes in obj format. In this format, the shapes are made up of a number of triangles. Using a MATLAB function, I can import data of these shapes into MATLAB. The data are made up of the coordinates of the triangles’ vertices, the vector of the triangles’ surface normals and the triangles’ area. Using the function on one of the files looks like this:
[vertices, surfaceNormals, areas] = objImport(‘some3dShape.obj’);
Now, vertices is a double array of size 3x3xN. N is the number of triangles of this shape and there are three vertices per triangle and each vertex is described by three coordinates. Consequently, surfaceNormals is of size 3xN and areas is of size 1xN.
I want to use these data of multiple shapes in a Simulink simulation. So, I thought, that I could store the data of all shapes nicely in a struct array in the MATLAB workspace before starting the simulation.
shapes = struct();
[shapes(1).vertices, shapes(1).surfaceNormals, shapes(1).areas] = objImport(‘shape1.obj’);
[shapes(2).vertices, shapes(2).surfaceNormals, shapes(2).areas] = objImport(‘shape2.obj’);
[shapes(3).vertices, shapes(3).surfaceNormals, shapes(3).areas] = objImport(‘shape3.obj’);
A MATLAB function block within the Simulink simulation could then access the shapes struct array from the MATLAB workspace as parameter data.
At least, that was the idea. MATLAB can deal with this kind of struct array. However, Simulink throws the error message "Mixed field types in structure arrays are not supported". This only works if all fields with the same name in the struct array have the same size. So, if shapes(1).vertices had size 3x3x100, then shapes(2).vertices would also have to have this size, meaning all shapes must be made up of the same number of triangles.
I am assuming that this error is the same one as described here. So, I am assuming this has to do with the compilation of the simulation into C code.
Possible Solutions I came up with
Create a new struct for every shape (shape1, shape2, …).
Pad the smaller arrays with zeros and add another field that keeps track of the actual amount of triangles per shape.
Solution 1 has the drawback that I would have to adapt my simulation every time I use a different number of shapes. I wanted to use the struct array so that the MATLAB function block can simply iterate over all struct array items in order to keep the simulation as generic as possible.
Solution 2 seems inefficient. If one of the shapes has a lot of triangles, then the struct array items of the other shapes would also have use up the same amount of memory even if they actually had a lot less triangles.
Are there any other solutions? Is there maybe some pointer-based alternative to struct arrays that does not store the actual data but just a pointer to it? That way the fields would all have the same size (that of a pointer). simulink, struct MATLAB Answers — New Questions
How to save an image without axis or white space?
I am currently trying to save an image adn then reopen that image in MATLAB. I am running into an issue that when I save that image it is saving with the axis. This then causes me to reopen the image and have the image be a different diemnsion due to the axis saving. I have then turned off the axis as peopel have recommended from readings other comments on similar problems. However, when I turn off the axis, then the space where the axis used to be saves as white space on my image. I want to open the image and save the image as the same size. I have attached a few pictures of what the image saving looks like. I have attahced the orgional image called square, the working image which is the image without after saved and reopened in MATLAB, and then the same thing hapening wiht the axis which is the screen shot.
Attached below is also my current code for this section of my code.
set(gca, ‘Visible’, ‘off’);
saveas(gcf,’working_image.jpg’);
close all
img = imread(‘working_image.jpg’); % Replace with your image fileI am currently trying to save an image adn then reopen that image in MATLAB. I am running into an issue that when I save that image it is saving with the axis. This then causes me to reopen the image and have the image be a different diemnsion due to the axis saving. I have then turned off the axis as peopel have recommended from readings other comments on similar problems. However, when I turn off the axis, then the space where the axis used to be saves as white space on my image. I want to open the image and save the image as the same size. I have attached a few pictures of what the image saving looks like. I have attahced the orgional image called square, the working image which is the image without after saved and reopened in MATLAB, and then the same thing hapening wiht the axis which is the screen shot.
Attached below is also my current code for this section of my code.
set(gca, ‘Visible’, ‘off’);
saveas(gcf,’working_image.jpg’);
close all
img = imread(‘working_image.jpg’); % Replace with your image file I am currently trying to save an image adn then reopen that image in MATLAB. I am running into an issue that when I save that image it is saving with the axis. This then causes me to reopen the image and have the image be a different diemnsion due to the axis saving. I have then turned off the axis as peopel have recommended from readings other comments on similar problems. However, when I turn off the axis, then the space where the axis used to be saves as white space on my image. I want to open the image and save the image as the same size. I have attached a few pictures of what the image saving looks like. I have attahced the orgional image called square, the working image which is the image without after saved and reopened in MATLAB, and then the same thing hapening wiht the axis which is the screen shot.
Attached below is also my current code for this section of my code.
set(gca, ‘Visible’, ‘off’);
saveas(gcf,’working_image.jpg’);
close all
img = imread(‘working_image.jpg’); % Replace with your image file opening image, saving image MATLAB Answers — New Questions
How can I download the installer for a previous update of MATLAB?
How can I download the installer for a previous update of MATLAB?How can I download the installer for a previous update of MATLAB? How can I download the installer for a previous update of MATLAB? MATLAB Answers — New Questions
Solver configuration error concerning an algebraic loop in double fed induction machine control model.
Good evening.
I am modelling a double fed induction machine in simulink, using simscape for physical components such as stator and rotor sources as well as the DFIG, and simulink for the control block. However when I run the program it gives the following error I show below concerning de Solver Confguration. Any ideas on how to solve it?
Error:’dfig_control_rotor/Solver Configuration’ or the model referenced by it contains a block that updates persistent or state variables while computing outputs and is not supported in an algebraic loop. It is in an algebraic loop with the following blocks.
Error:’dfig_control_rotor/Solver Configuration’ or the model referenced by it contains a block that updates persistent or state variables while computing outputs and is not supported in an algebraic loop. It is in an algebraic loop with the following blocks.
And many more but I guess the main problem is here.
Thanks in advance.Good evening.
I am modelling a double fed induction machine in simulink, using simscape for physical components such as stator and rotor sources as well as the DFIG, and simulink for the control block. However when I run the program it gives the following error I show below concerning de Solver Confguration. Any ideas on how to solve it?
Error:’dfig_control_rotor/Solver Configuration’ or the model referenced by it contains a block that updates persistent or state variables while computing outputs and is not supported in an algebraic loop. It is in an algebraic loop with the following blocks.
Error:’dfig_control_rotor/Solver Configuration’ or the model referenced by it contains a block that updates persistent or state variables while computing outputs and is not supported in an algebraic loop. It is in an algebraic loop with the following blocks.
And many more but I guess the main problem is here.
Thanks in advance. Good evening.
I am modelling a double fed induction machine in simulink, using simscape for physical components such as stator and rotor sources as well as the DFIG, and simulink for the control block. However when I run the program it gives the following error I show below concerning de Solver Confguration. Any ideas on how to solve it?
Error:’dfig_control_rotor/Solver Configuration’ or the model referenced by it contains a block that updates persistent or state variables while computing outputs and is not supported in an algebraic loop. It is in an algebraic loop with the following blocks.
Error:’dfig_control_rotor/Solver Configuration’ or the model referenced by it contains a block that updates persistent or state variables while computing outputs and is not supported in an algebraic loop. It is in an algebraic loop with the following blocks.
And many more but I guess the main problem is here.
Thanks in advance. simulink, simscape, loop, error MATLAB Answers — New Questions
Subs Result Still Has Symbolic Variable In It
So as you can see from the result from the console, I am attempting to substitute all the symbolic variables in the symbolic expression tauB(1) with values. But the result of this substitution still has one of the symbolic variables that I substituted for in it? Not sure why this is or how to fix it. tauB(1) is a bit of a length expression but I’ll post it here anyway.
>> tauB(1)
ans =
– (4115149222386437697*rpm1^5)/12980742146337069071326240823050240000000 + (21808513960237945171*rpm1^4)/792281625142643375935439503360000000 – (21217777204886075429*rpm1^3)/24178516392292583494123520000000 + (10349500888931238881*rpm1^2)/737869762948382064640000000 – (29738775089977568461*rpm1)/360287970189639680000000 + (4115149222386437697*rpm2^5)/12980742146337069071326240823050240000000 – (21808513960237945171*rpm2^4)/792281625142643375935439503360000000 + (21217777204886075429*rpm2^3)/24178516392292583494123520000000 – (10349500888931238881*rpm2^2)/737869762948382064640000000 + (29738775089977568461*rpm2)/360287970189639680000000 + (4115149222386437697*rpm3^5)/12980742146337069071326240823050240000000 – (21808513960237945171*rpm3^4)/792281625142643375935439503360000000 + (21217777204886075429*rpm3^3)/24178516392292583494123520000000 – (10349500888931238881*rpm3^2)/737869762948382064640000000 + (29738775089977568461*rpm3)/360287970189639680000000 – (4115149222386437697*rpm4^5)/12980742146337069071326240823050240000000 + (21808513960237945171*rpm4^4)/792281625142643375935439503360000000 – (21217777204886075429*rpm4^3)/24178516392292583494123520000000 + (10349500888931238881*rpm4^2)/737869762948382064640000000 – (29738775089977568461*rpm4)/360287970189639680000000 + w_kp
Any idea how to fix the subs command to get it to truly substitute for all symbolic vars?So as you can see from the result from the console, I am attempting to substitute all the symbolic variables in the symbolic expression tauB(1) with values. But the result of this substitution still has one of the symbolic variables that I substituted for in it? Not sure why this is or how to fix it. tauB(1) is a bit of a length expression but I’ll post it here anyway.
>> tauB(1)
ans =
– (4115149222386437697*rpm1^5)/12980742146337069071326240823050240000000 + (21808513960237945171*rpm1^4)/792281625142643375935439503360000000 – (21217777204886075429*rpm1^3)/24178516392292583494123520000000 + (10349500888931238881*rpm1^2)/737869762948382064640000000 – (29738775089977568461*rpm1)/360287970189639680000000 + (4115149222386437697*rpm2^5)/12980742146337069071326240823050240000000 – (21808513960237945171*rpm2^4)/792281625142643375935439503360000000 + (21217777204886075429*rpm2^3)/24178516392292583494123520000000 – (10349500888931238881*rpm2^2)/737869762948382064640000000 + (29738775089977568461*rpm2)/360287970189639680000000 + (4115149222386437697*rpm3^5)/12980742146337069071326240823050240000000 – (21808513960237945171*rpm3^4)/792281625142643375935439503360000000 + (21217777204886075429*rpm3^3)/24178516392292583494123520000000 – (10349500888931238881*rpm3^2)/737869762948382064640000000 + (29738775089977568461*rpm3)/360287970189639680000000 – (4115149222386437697*rpm4^5)/12980742146337069071326240823050240000000 + (21808513960237945171*rpm4^4)/792281625142643375935439503360000000 – (21217777204886075429*rpm4^3)/24178516392292583494123520000000 + (10349500888931238881*rpm4^2)/737869762948382064640000000 – (29738775089977568461*rpm4)/360287970189639680000000 + w_kp
Any idea how to fix the subs command to get it to truly substitute for all symbolic vars? So as you can see from the result from the console, I am attempting to substitute all the symbolic variables in the symbolic expression tauB(1) with values. But the result of this substitution still has one of the symbolic variables that I substituted for in it? Not sure why this is or how to fix it. tauB(1) is a bit of a length expression but I’ll post it here anyway.
>> tauB(1)
ans =
– (4115149222386437697*rpm1^5)/12980742146337069071326240823050240000000 + (21808513960237945171*rpm1^4)/792281625142643375935439503360000000 – (21217777204886075429*rpm1^3)/24178516392292583494123520000000 + (10349500888931238881*rpm1^2)/737869762948382064640000000 – (29738775089977568461*rpm1)/360287970189639680000000 + (4115149222386437697*rpm2^5)/12980742146337069071326240823050240000000 – (21808513960237945171*rpm2^4)/792281625142643375935439503360000000 + (21217777204886075429*rpm2^3)/24178516392292583494123520000000 – (10349500888931238881*rpm2^2)/737869762948382064640000000 + (29738775089977568461*rpm2)/360287970189639680000000 + (4115149222386437697*rpm3^5)/12980742146337069071326240823050240000000 – (21808513960237945171*rpm3^4)/792281625142643375935439503360000000 + (21217777204886075429*rpm3^3)/24178516392292583494123520000000 – (10349500888931238881*rpm3^2)/737869762948382064640000000 + (29738775089977568461*rpm3)/360287970189639680000000 – (4115149222386437697*rpm4^5)/12980742146337069071326240823050240000000 + (21808513960237945171*rpm4^4)/792281625142643375935439503360000000 – (21217777204886075429*rpm4^3)/24178516392292583494123520000000 + (10349500888931238881*rpm4^2)/737869762948382064640000000 – (29738775089977568461*rpm4)/360287970189639680000000 + w_kp
Any idea how to fix the subs command to get it to truly substitute for all symbolic vars? syms, symbolic variables, subs MATLAB Answers — New Questions
Is it possible to use the simulink model as a function in matlab?
I’d like to call a model I’ve created on simulink as a matlab function. Is this possible?I’d like to call a model I’ve created on simulink as a matlab function. Is this possible? I’d like to call a model I’ve created on simulink as a matlab function. Is this possible? function, simulink MATLAB Answers — New Questions