Category: Matlab
Category Archives: Matlab
Error message: Matrix Dimensions must agree
Not sure what I am doing wrong:
syms x
n = 0:1:100;
t = 0:0.1:50;
lamda = (n .* pi);
u = (100 .* cosd(lamda .* x) + (sind(lamda .* x)) .* (exp((-lamda .^ 2) .* t) ;
fplot(t,u)
grid on
Thank youNot sure what I am doing wrong:
syms x
n = 0:1:100;
t = 0:0.1:50;
lamda = (n .* pi);
u = (100 .* cosd(lamda .* x) + (sind(lamda .* x)) .* (exp((-lamda .^ 2) .* t) ;
fplot(t,u)
grid on
Thank you Not sure what I am doing wrong:
syms x
n = 0:1:100;
t = 0:0.1:50;
lamda = (n .* pi);
u = (100 .* cosd(lamda .* x) + (sind(lamda .* x)) .* (exp((-lamda .^ 2) .* t) ;
fplot(t,u)
grid on
Thank you matrix dimensions must agree MATLAB Answers — New Questions
Least Frequent Words in document
If I use topkwords to find the most-frequent words, what code can I use to show the 10-least frequent words?If I use topkwords to find the most-frequent words, what code can I use to show the 10-least frequent words? If I use topkwords to find the most-frequent words, what code can I use to show the 10-least frequent words? textanalyticstoolbox MATLAB Answers — New Questions
Eliminate for-loop in recursive computation?
I’m trying to speed up a recursive calculation that is currently using a for-loop. A minimum working example is below. There are two computations in the recursion: "pn0" and "fact". I have figured out how to do fact out side the loop, but pn0 is giving me trouble. Any insight into how to remove the loop and/or speed this up would be greatly appreaciated! I have tried building up a separate function and using arrayfun, but that is calling a loop under the hood, so I don’t think it would be faster.
% define some constants
m = 0:10;
y = cos(pi/4);
% compute fact without a loop
fact = cumsum([1 ones(1,size(m,2)).*2]);
fact = fact(1:end-1);
% Generate the correct pn0 array
pn0 = 1; % initial value
factdum = 1; % initial value
pn_out = [];
fact_out = [];
for mm = 0:10
pn0 = -pn0*factdum*y; % do the computation <– this is the computation I’m trying to pull out of the loop
pn_out = [pn_out,pn0]; % store the pn0 array output
fact_out = [fact_out,factdum]; % store the fact array output
factdum = factdum + 2; % compute fact inside the loop to make sure it was done correctly outside the loop.
endI’m trying to speed up a recursive calculation that is currently using a for-loop. A minimum working example is below. There are two computations in the recursion: "pn0" and "fact". I have figured out how to do fact out side the loop, but pn0 is giving me trouble. Any insight into how to remove the loop and/or speed this up would be greatly appreaciated! I have tried building up a separate function and using arrayfun, but that is calling a loop under the hood, so I don’t think it would be faster.
% define some constants
m = 0:10;
y = cos(pi/4);
% compute fact without a loop
fact = cumsum([1 ones(1,size(m,2)).*2]);
fact = fact(1:end-1);
% Generate the correct pn0 array
pn0 = 1; % initial value
factdum = 1; % initial value
pn_out = [];
fact_out = [];
for mm = 0:10
pn0 = -pn0*factdum*y; % do the computation <– this is the computation I’m trying to pull out of the loop
pn_out = [pn_out,pn0]; % store the pn0 array output
fact_out = [fact_out,factdum]; % store the fact array output
factdum = factdum + 2; % compute fact inside the loop to make sure it was done correctly outside the loop.
end I’m trying to speed up a recursive calculation that is currently using a for-loop. A minimum working example is below. There are two computations in the recursion: "pn0" and "fact". I have figured out how to do fact out side the loop, but pn0 is giving me trouble. Any insight into how to remove the loop and/or speed this up would be greatly appreaciated! I have tried building up a separate function and using arrayfun, but that is calling a loop under the hood, so I don’t think it would be faster.
% define some constants
m = 0:10;
y = cos(pi/4);
% compute fact without a loop
fact = cumsum([1 ones(1,size(m,2)).*2]);
fact = fact(1:end-1);
% Generate the correct pn0 array
pn0 = 1; % initial value
factdum = 1; % initial value
pn_out = [];
fact_out = [];
for mm = 0:10
pn0 = -pn0*factdum*y; % do the computation <– this is the computation I’m trying to pull out of the loop
pn_out = [pn_out,pn0]; % store the pn0 array output
fact_out = [fact_out,factdum]; % store the fact array output
factdum = factdum + 2; % compute fact inside the loop to make sure it was done correctly outside the loop.
end recursion, eliminate for loop MATLAB Answers — New Questions
Error plot is starting at the wrong value in my “while loop”
clear all
w=(12.35)^0.5;
%theta_exact=10*exp(-2*t)*cos(t*w)+20*exp(-2*t)*sin(w*t);
theta1(1)=10; %deg
psy1(1)=0; %deg/s
g=9.81; %m/s^2
c=4; %1/s
l=0.6; %m
dt1=0.1;
t1(1)=0;
i=1;
while t1<6
theta1(i+1)=theta1(i)+psy1(i)*dt1
psy1(i+1)=(-g/l)*dt1*theta1(i)+(1-c*dt1)*psy1(i);
theta_exact=10.*exp(-2.*t1).*cos(w.*t1)+(20/w).*exp(-2.*t1).*sin(w.*t1)
epsilon1=(theta1(i)-theta_exact)
t1(i+1)=t1(i)+dt1;
i=i+1;
end
figure(1); clf;
hold on
plot(t1,theta1,’red’)
plot(t1(1:end-1),theta_exact,’blue’)
figure(2); clf;
plot(t1(1:end-1),(epsilon1))
If you read the code you notice that the second plot is a time vs "epsilon1". My issue is that the first value for "epsilon1" is -10 but epsilon1=(theta1(i)-theta_exact), where theta1(i) and theta_exact are the same value for their first values. The first value should read 0 for epsilon1, can anyone help me figure out why this is not the case?clear all
w=(12.35)^0.5;
%theta_exact=10*exp(-2*t)*cos(t*w)+20*exp(-2*t)*sin(w*t);
theta1(1)=10; %deg
psy1(1)=0; %deg/s
g=9.81; %m/s^2
c=4; %1/s
l=0.6; %m
dt1=0.1;
t1(1)=0;
i=1;
while t1<6
theta1(i+1)=theta1(i)+psy1(i)*dt1
psy1(i+1)=(-g/l)*dt1*theta1(i)+(1-c*dt1)*psy1(i);
theta_exact=10.*exp(-2.*t1).*cos(w.*t1)+(20/w).*exp(-2.*t1).*sin(w.*t1)
epsilon1=(theta1(i)-theta_exact)
t1(i+1)=t1(i)+dt1;
i=i+1;
end
figure(1); clf;
hold on
plot(t1,theta1,’red’)
plot(t1(1:end-1),theta_exact,’blue’)
figure(2); clf;
plot(t1(1:end-1),(epsilon1))
If you read the code you notice that the second plot is a time vs "epsilon1". My issue is that the first value for "epsilon1" is -10 but epsilon1=(theta1(i)-theta_exact), where theta1(i) and theta_exact are the same value for their first values. The first value should read 0 for epsilon1, can anyone help me figure out why this is not the case? clear all
w=(12.35)^0.5;
%theta_exact=10*exp(-2*t)*cos(t*w)+20*exp(-2*t)*sin(w*t);
theta1(1)=10; %deg
psy1(1)=0; %deg/s
g=9.81; %m/s^2
c=4; %1/s
l=0.6; %m
dt1=0.1;
t1(1)=0;
i=1;
while t1<6
theta1(i+1)=theta1(i)+psy1(i)*dt1
psy1(i+1)=(-g/l)*dt1*theta1(i)+(1-c*dt1)*psy1(i);
theta_exact=10.*exp(-2.*t1).*cos(w.*t1)+(20/w).*exp(-2.*t1).*sin(w.*t1)
epsilon1=(theta1(i)-theta_exact)
t1(i+1)=t1(i)+dt1;
i=i+1;
end
figure(1); clf;
hold on
plot(t1,theta1,’red’)
plot(t1(1:end-1),theta_exact,’blue’)
figure(2); clf;
plot(t1(1:end-1),(epsilon1))
If you read the code you notice that the second plot is a time vs "epsilon1". My issue is that the first value for "epsilon1" is -10 but epsilon1=(theta1(i)-theta_exact), where theta1(i) and theta_exact are the same value for their first values. The first value should read 0 for epsilon1, can anyone help me figure out why this is not the case? while loop, forward differencing MATLAB Answers — New Questions
OPC DA Write issues
Hi I used to program on Simulink using the OPC DA Config, OPC Write/Read blocks and till version 2017 it worked just fine. Now I implemented it on 2024b version and by the time I want to test it there’s this error that says:
Error:The corresponding ‘opcslwrite.tlc’ file for the MATLAB S-function ‘opcslwrite’ in block ‘hardprog/OPC Write’ must be located in the current working directory, the MATLAB S-function directory ‘C:Program FilesMATLABR2024btoolboxicommopcopcblksopcblks’, or the directory ‘C:Program FilesMATLABR2024btoolboxicommopcopcblksopcblkstlc_c’
I can configure the OPC DA Config Real-Time block, but when I try to add a tag there’s a sound of error and the Browse Name Space shows up but I can’t click in OK nor Cancel it remains there and then I can’t do a thing.
Thank you!Hi I used to program on Simulink using the OPC DA Config, OPC Write/Read blocks and till version 2017 it worked just fine. Now I implemented it on 2024b version and by the time I want to test it there’s this error that says:
Error:The corresponding ‘opcslwrite.tlc’ file for the MATLAB S-function ‘opcslwrite’ in block ‘hardprog/OPC Write’ must be located in the current working directory, the MATLAB S-function directory ‘C:Program FilesMATLABR2024btoolboxicommopcopcblksopcblks’, or the directory ‘C:Program FilesMATLABR2024btoolboxicommopcopcblksopcblkstlc_c’
I can configure the OPC DA Config Real-Time block, but when I try to add a tag there’s a sound of error and the Browse Name Space shows up but I can’t click in OK nor Cancel it remains there and then I can’t do a thing.
Thank you! Hi I used to program on Simulink using the OPC DA Config, OPC Write/Read blocks and till version 2017 it worked just fine. Now I implemented it on 2024b version and by the time I want to test it there’s this error that says:
Error:The corresponding ‘opcslwrite.tlc’ file for the MATLAB S-function ‘opcslwrite’ in block ‘hardprog/OPC Write’ must be located in the current working directory, the MATLAB S-function directory ‘C:Program FilesMATLABR2024btoolboxicommopcopcblksopcblks’, or the directory ‘C:Program FilesMATLABR2024btoolboxicommopcopcblksopcblkstlc_c’
I can configure the OPC DA Config Real-Time block, but when I try to add a tag there’s a sound of error and the Browse Name Space shows up but I can’t click in OK nor Cancel it remains there and then I can’t do a thing.
Thank you! opc, simulink, tlc MATLAB Answers — New Questions
why won’t this work?
I want this code to read a text file, convert it to ASCII Characters, make a pie chart over the ten most occurring numbers, be able to change for instance an "a" to "c" (two steps) and the program to make two steps everywhere in the text and then print the new text.
Will be very grateful for your help!
fid=fopen(‘krypterad1.txt’,’rt’);%Open text file
text = fscanf(fid,’%c’,Inf);%Read text file
text = upper(text);%Convert to upper cases
nummer = double(text);%Convert text to Ascii
n = histc(nummer, 65:90);
for nummer =65:90;
for antal=1:n
end
end
[B,IX] = sort(n, ‘descend’);%Sort array B in descending order
fprintf(‘%dn’,B);%Print array B
pie(B(1,10)’)%Make pie chart of the ten most occuring numbers in the array (doesn’t work)
title(‘De 10 mest förekommande bokstäverna i texten’)%Chart title
f = input(‘byt från ‘,’s’)
t = input(’till ‘,’s’)
diff = double(t) – double(f)
for rulla = nummer-(diff)
if rulla<=64, rulla=rulla+26; end
if rulla>90, rulla=rulla-26; end
okodadtext = char(rulla);
fprintf(‘%s’,okodadtext)
endI want this code to read a text file, convert it to ASCII Characters, make a pie chart over the ten most occurring numbers, be able to change for instance an "a" to "c" (two steps) and the program to make two steps everywhere in the text and then print the new text.
Will be very grateful for your help!
fid=fopen(‘krypterad1.txt’,’rt’);%Open text file
text = fscanf(fid,’%c’,Inf);%Read text file
text = upper(text);%Convert to upper cases
nummer = double(text);%Convert text to Ascii
n = histc(nummer, 65:90);
for nummer =65:90;
for antal=1:n
end
end
[B,IX] = sort(n, ‘descend’);%Sort array B in descending order
fprintf(‘%dn’,B);%Print array B
pie(B(1,10)’)%Make pie chart of the ten most occuring numbers in the array (doesn’t work)
title(‘De 10 mest förekommande bokstäverna i texten’)%Chart title
f = input(‘byt från ‘,’s’)
t = input(’till ‘,’s’)
diff = double(t) – double(f)
for rulla = nummer-(diff)
if rulla<=64, rulla=rulla+26; end
if rulla>90, rulla=rulla-26; end
okodadtext = char(rulla);
fprintf(‘%s’,okodadtext)
end I want this code to read a text file, convert it to ASCII Characters, make a pie chart over the ten most occurring numbers, be able to change for instance an "a" to "c" (two steps) and the program to make two steps everywhere in the text and then print the new text.
Will be very grateful for your help!
fid=fopen(‘krypterad1.txt’,’rt’);%Open text file
text = fscanf(fid,’%c’,Inf);%Read text file
text = upper(text);%Convert to upper cases
nummer = double(text);%Convert text to Ascii
n = histc(nummer, 65:90);
for nummer =65:90;
for antal=1:n
end
end
[B,IX] = sort(n, ‘descend’);%Sort array B in descending order
fprintf(‘%dn’,B);%Print array B
pie(B(1,10)’)%Make pie chart of the ten most occuring numbers in the array (doesn’t work)
title(‘De 10 mest förekommande bokstäverna i texten’)%Chart title
f = input(‘byt från ‘,’s’)
t = input(’till ‘,’s’)
diff = double(t) – double(f)
for rulla = nummer-(diff)
if rulla<=64, rulla=rulla+26; end
if rulla>90, rulla=rulla-26; end
okodadtext = char(rulla);
fprintf(‘%s’,okodadtext)
end for loop, pie, if statement MATLAB Answers — New Questions
Finite Element Analysis for Fixed Ended Beam with a Point Load example: I am getting this error: Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the se
Fixed Ended Beam with Point Load Example
%Data
E = 2.1E5; % N/mm^2
L = 6000; % length in mm
I = 78E6; % mm^4
Elemental Stiffness Matrix
Const = (E*I)/(L^3);
%Since we only have one element this is the overall
%stiffness matrix
KE1 = [12 6*L -12 6*L;
6*L 4*L^2 -6*L 2*L^2;
-12 -6*L 12 -6*L;
6*L 2*L^2 -6*L 4*L^2];
KE1 = Const*KE1;
Solution
K = KE1;
KT = K;
KT(:,1) = 0;
KT(1,:) = 0;
KT(1,1) = 1;
KT(:,2) = 0;
KT(2,:) = 0;
KT(2,2) = 1;
KT(:,4) = 0;
KT(4,:) = 0;
KT(4,4) = 1;
KT(:,5) = 0;
KT(5,:) = 0;
KT(5,5) = 1;
KT(:,6) = 0;
KT(6,:) = 0;
KT(6,6) = 1;
KT
FT = [0;0; -50;0; 0;0];
d = inv(KT)*FT
F = K*dFixed Ended Beam with Point Load Example
%Data
E = 2.1E5; % N/mm^2
L = 6000; % length in mm
I = 78E6; % mm^4
Elemental Stiffness Matrix
Const = (E*I)/(L^3);
%Since we only have one element this is the overall
%stiffness matrix
KE1 = [12 6*L -12 6*L;
6*L 4*L^2 -6*L 2*L^2;
-12 -6*L 12 -6*L;
6*L 2*L^2 -6*L 4*L^2];
KE1 = Const*KE1;
Solution
K = KE1;
KT = K;
KT(:,1) = 0;
KT(1,:) = 0;
KT(1,1) = 1;
KT(:,2) = 0;
KT(2,:) = 0;
KT(2,2) = 1;
KT(:,4) = 0;
KT(4,:) = 0;
KT(4,4) = 1;
KT(:,5) = 0;
KT(5,:) = 0;
KT(5,5) = 1;
KT(:,6) = 0;
KT(6,:) = 0;
KT(6,6) = 1;
KT
FT = [0;0; -50;0; 0;0];
d = inv(KT)*FT
F = K*d Fixed Ended Beam with Point Load Example
%Data
E = 2.1E5; % N/mm^2
L = 6000; % length in mm
I = 78E6; % mm^4
Elemental Stiffness Matrix
Const = (E*I)/(L^3);
%Since we only have one element this is the overall
%stiffness matrix
KE1 = [12 6*L -12 6*L;
6*L 4*L^2 -6*L 2*L^2;
-12 -6*L 12 -6*L;
6*L 2*L^2 -6*L 4*L^2];
KE1 = Const*KE1;
Solution
K = KE1;
KT = K;
KT(:,1) = 0;
KT(1,:) = 0;
KT(1,1) = 1;
KT(:,2) = 0;
KT(2,:) = 0;
KT(2,2) = 1;
KT(:,4) = 0;
KT(4,:) = 0;
KT(4,4) = 1;
KT(:,5) = 0;
KT(5,:) = 0;
KT(5,5) = 1;
KT(:,6) = 0;
KT(6,:) = 0;
KT(6,6) = 1;
KT
FT = [0;0; -50;0; 0;0];
d = inv(KT)*FT
F = K*d #matlab, #finiteelementanalysis, #fixedendedbeam, #pointload MATLAB Answers — New Questions
Why SIMULINK circuit and SIMCAPE circuit don’t give same results?
Hello Community!!
I’m trying to simulate a T-Type NPC PFC rectifier (yes, I know here at MATLAB exchange we have the VIENNA example but that is a Y-switch Rectifier…just saying~), I designed the 12 switch T-NPC exactly the same (valies and all) on each platform: SIMULINK and SIMSCAPE (attached).
I assume both approaches should have the same way to solve and generate the same result waveforms but as you might see on both of them the resuls are not even close.
Am I doing something wrong with SIMSCAPE that makes this difference? The circuit in SIMULINK is satisfactory, is it possibole to migrate it to SIMSCAPE somehow with some App (just to confirm I didn’t make a mistake on it)?
ThanksHello Community!!
I’m trying to simulate a T-Type NPC PFC rectifier (yes, I know here at MATLAB exchange we have the VIENNA example but that is a Y-switch Rectifier…just saying~), I designed the 12 switch T-NPC exactly the same (valies and all) on each platform: SIMULINK and SIMSCAPE (attached).
I assume both approaches should have the same way to solve and generate the same result waveforms but as you might see on both of them the resuls are not even close.
Am I doing something wrong with SIMSCAPE that makes this difference? The circuit in SIMULINK is satisfactory, is it possibole to migrate it to SIMSCAPE somehow with some App (just to confirm I didn’t make a mistake on it)?
Thanks Hello Community!!
I’m trying to simulate a T-Type NPC PFC rectifier (yes, I know here at MATLAB exchange we have the VIENNA example but that is a Y-switch Rectifier…just saying~), I designed the 12 switch T-NPC exactly the same (valies and all) on each platform: SIMULINK and SIMSCAPE (attached).
I assume both approaches should have the same way to solve and generate the same result waveforms but as you might see on both of them the resuls are not even close.
Am I doing something wrong with SIMSCAPE that makes this difference? The circuit in SIMULINK is satisfactory, is it possibole to migrate it to SIMSCAPE somehow with some App (just to confirm I didn’t make a mistake on it)?
Thanks t-type npc pfc, t-npc MATLAB Answers — New Questions
Infinite nested loop in matlab
I want to write a program that user enter the value of n that is the number of nested loops. n is dynamic and can change by user (if n=3 then we should have 3 loops inside loop as the same below)
for i=1:100
for j=1:100-i
for k=1:100-i-j
i+j+k
end
end
end
how should i program this??I want to write a program that user enter the value of n that is the number of nested loops. n is dynamic and can change by user (if n=3 then we should have 3 loops inside loop as the same below)
for i=1:100
for j=1:100-i
for k=1:100-i-j
i+j+k
end
end
end
how should i program this?? I want to write a program that user enter the value of n that is the number of nested loops. n is dynamic and can change by user (if n=3 then we should have 3 loops inside loop as the same below)
for i=1:100
for j=1:100-i
for k=1:100-i-j
i+j+k
end
end
end
how should i program this?? infinite nested loop MATLAB Answers — New Questions
Removing Background from image or a video
Hello,
I have one video , in that video one car in passing 2-d direction, i convert that video into freams ,
so now i have N number of frames i picked one frame and i want to remove the background of that car and i want to apply this on whole video or N no. of frames .
Can you help me?Hello,
I have one video , in that video one car in passing 2-d direction, i convert that video into freams ,
so now i have N number of frames i picked one frame and i want to remove the background of that car and i want to apply this on whole video or N no. of frames .
Can you help me? Hello,
I have one video , in that video one car in passing 2-d direction, i convert that video into freams ,
so now i have N number of frames i picked one frame and i want to remove the background of that car and i want to apply this on whole video or N no. of frames .
Can you help me? image segmentation, background remove MATLAB Answers — New Questions
Converting timestamp from TDMS LabView
I received measurement data using LabView as a TDMS file and use TDMS reader from https://se.mathworks.com/matlabcentral/fileexchange/30023-tdms-reader to import it. The file name itself already indicated date and time of the measurement, e.g., COP_meas1_25-01-27_1237.tdms, but the resolution was only 1 s.
Using excel with AddOn from NI, I got the following results:
From values attached to this question.
Using
datetime(timestamp(1:5),’ConvertFrom’,’datenum’,’TicksPerSecond’,1e4,’Format’,’HH:mm:ss.SSSS’)
I got the following results.
05:37:04.1507
05:37:04.1520
05:37:04.1532
05:37:04.1545
05:37:04.1557
Using
datetime(timestamp(1),’ConvertFrom’,’posixtime’)
I got
09-Jan-1970 13:27:24
I have tried using various combinations but I failed. How should I use the parameters to get the same results as in Excel?I received measurement data using LabView as a TDMS file and use TDMS reader from https://se.mathworks.com/matlabcentral/fileexchange/30023-tdms-reader to import it. The file name itself already indicated date and time of the measurement, e.g., COP_meas1_25-01-27_1237.tdms, but the resolution was only 1 s.
Using excel with AddOn from NI, I got the following results:
From values attached to this question.
Using
datetime(timestamp(1:5),’ConvertFrom’,’datenum’,’TicksPerSecond’,1e4,’Format’,’HH:mm:ss.SSSS’)
I got the following results.
05:37:04.1507
05:37:04.1520
05:37:04.1532
05:37:04.1545
05:37:04.1557
Using
datetime(timestamp(1),’ConvertFrom’,’posixtime’)
I got
09-Jan-1970 13:27:24
I have tried using various combinations but I failed. How should I use the parameters to get the same results as in Excel? I received measurement data using LabView as a TDMS file and use TDMS reader from https://se.mathworks.com/matlabcentral/fileexchange/30023-tdms-reader to import it. The file name itself already indicated date and time of the measurement, e.g., COP_meas1_25-01-27_1237.tdms, but the resolution was only 1 s.
Using excel with AddOn from NI, I got the following results:
From values attached to this question.
Using
datetime(timestamp(1:5),’ConvertFrom’,’datenum’,’TicksPerSecond’,1e4,’Format’,’HH:mm:ss.SSSS’)
I got the following results.
05:37:04.1507
05:37:04.1520
05:37:04.1532
05:37:04.1545
05:37:04.1557
Using
datetime(timestamp(1),’ConvertFrom’,’posixtime’)
I got
09-Jan-1970 13:27:24
I have tried using various combinations but I failed. How should I use the parameters to get the same results as in Excel? tdms MATLAB Answers — New Questions
In an old file *.sfit, can I check the matrix with the data that I added for the Z coordinate for example?
I created a curve for X, Y and Z axis with a formula that I added manually. After a few days, I wanted to check if I added the correct data on the Z axis, how can I see the exact numeric matrix that I added to the *.sfit file?I created a curve for X, Y and Z axis with a formula that I added manually. After a few days, I wanted to check if I added the correct data on the Z axis, how can I see the exact numeric matrix that I added to the *.sfit file? I created a curve for X, Y and Z axis with a formula that I added manually. After a few days, I wanted to check if I added the correct data on the Z axis, how can I see the exact numeric matrix that I added to the *.sfit file? sfit, curve fitter, data check MATLAB Answers — New Questions
How to get the exact lat lon position of nc file data
Hi Folks
Thanks in advance
I could get the indexed position of the rows and columns of max / index value data with the below code
maxval=max(data(:));
[xmax,ymax]=find(data==maxval);
[ii,jj]=find(data >= 0 & data < 2);
but I need only the exact x and y location coordinates
I have classify the pixel values range according to my requirement as below
idx = data >= 0 & data< 2 ;
pix1 = data(idx);
idx = data >= 2 & data < 4 ;
pix2 = data(idx) ;
idx = iwant >= 4 & iwant < 6 ;
pix3 = data(idx) ;
idx = data >= 6 & data < 8 ;
pix4 = data(idx) ;
idx = data >= 8 & data < 10;
pix5 = data(idx);
idx = data >= 10 & data < 15 ;
pix6 = data(idx) ;
idx = data >= 15 & data < 20 ;
pix7 = data(idx) ;
idx= data >= 20 & data < 95;
pix8 = data(idx);
please find the atached data and lat, lon position
Kindly helpHi Folks
Thanks in advance
I could get the indexed position of the rows and columns of max / index value data with the below code
maxval=max(data(:));
[xmax,ymax]=find(data==maxval);
[ii,jj]=find(data >= 0 & data < 2);
but I need only the exact x and y location coordinates
I have classify the pixel values range according to my requirement as below
idx = data >= 0 & data< 2 ;
pix1 = data(idx);
idx = data >= 2 & data < 4 ;
pix2 = data(idx) ;
idx = iwant >= 4 & iwant < 6 ;
pix3 = data(idx) ;
idx = data >= 6 & data < 8 ;
pix4 = data(idx) ;
idx = data >= 8 & data < 10;
pix5 = data(idx);
idx = data >= 10 & data < 15 ;
pix6 = data(idx) ;
idx = data >= 15 & data < 20 ;
pix7 = data(idx) ;
idx= data >= 20 & data < 95;
pix8 = data(idx);
please find the atached data and lat, lon position
Kindly help Hi Folks
Thanks in advance
I could get the indexed position of the rows and columns of max / index value data with the below code
maxval=max(data(:));
[xmax,ymax]=find(data==maxval);
[ii,jj]=find(data >= 0 & data < 2);
but I need only the exact x and y location coordinates
I have classify the pixel values range according to my requirement as below
idx = data >= 0 & data< 2 ;
pix1 = data(idx);
idx = data >= 2 & data < 4 ;
pix2 = data(idx) ;
idx = iwant >= 4 & iwant < 6 ;
pix3 = data(idx) ;
idx = data >= 6 & data < 8 ;
pix4 = data(idx) ;
idx = data >= 8 & data < 10;
pix5 = data(idx);
idx = data >= 10 & data < 15 ;
pix6 = data(idx) ;
idx = data >= 15 & data < 20 ;
pix7 = data(idx) ;
idx= data >= 20 & data < 95;
pix8 = data(idx);
please find the atached data and lat, lon position
Kindly help indexing, image processing, classification, data MATLAB Answers — New Questions
I get this error while launching Matlab and therefore it crashes while doing certain processes. Any solution ?
The Crash occurs while performing the first step in STAMPS PSI processing during loading the initial candidate PS pixels and stores them in MATLAB workspace files. I made sure there’s at least 69 gb of free space. I also performed very basic arithmatic operations since I am a beginner in Matlab just to make sure the program would function properly. When the crash occurs, the system become too laggy for a whileThe Crash occurs while performing the first step in STAMPS PSI processing during loading the initial candidate PS pixels and stores them in MATLAB workspace files. I made sure there’s at least 69 gb of free space. I also performed very basic arithmatic operations since I am a beginner in Matlab just to make sure the program would function properly. When the crash occurs, the system become too laggy for a while The Crash occurs while performing the first step in STAMPS PSI processing during loading the initial candidate PS pixels and stores them in MATLAB workspace files. I made sure there’s at least 69 gb of free space. I also performed very basic arithmatic operations since I am a beginner in Matlab just to make sure the program would function properly. When the crash occurs, the system become too laggy for a while canberra-gtk-module MATLAB Answers — New Questions
How to devide a matrix (n x 1) into 2 matrixes equally ?
I have some matrixes, and i need them to be devided into 2 parts equally, and the only part I use is the first part of it. For example, the matrix is A1 that contains 140 values (140 x1), second matrix is A2 contains 53 values (50 x 1), and so on. For matrix A1, I need to take the first 70 values, for matrix A2, i take the first 27 values, and so on. It has not to be in one loop to devide those matrixes all at once. An example only for 1 matrix would be helpful for me.
A1=rand(140,1);
A1d= …? %is first half part of A1
I hope somebody can help me with my problem.
Thanks in advance.I have some matrixes, and i need them to be devided into 2 parts equally, and the only part I use is the first part of it. For example, the matrix is A1 that contains 140 values (140 x1), second matrix is A2 contains 53 values (50 x 1), and so on. For matrix A1, I need to take the first 70 values, for matrix A2, i take the first 27 values, and so on. It has not to be in one loop to devide those matrixes all at once. An example only for 1 matrix would be helpful for me.
A1=rand(140,1);
A1d= …? %is first half part of A1
I hope somebody can help me with my problem.
Thanks in advance. I have some matrixes, and i need them to be devided into 2 parts equally, and the only part I use is the first part of it. For example, the matrix is A1 that contains 140 values (140 x1), second matrix is A2 contains 53 values (50 x 1), and so on. For matrix A1, I need to take the first 70 values, for matrix A2, i take the first 27 values, and so on. It has not to be in one loop to devide those matrixes all at once. An example only for 1 matrix would be helpful for me.
A1=rand(140,1);
A1d= …? %is first half part of A1
I hope somebody can help me with my problem.
Thanks in advance. matrix, matlab MATLAB Answers — New Questions
How to programmatically find the Simulink saved version for a .sldd dictionary object
I am now creating a MATLAB script to read the release versions in which a .sldd object is created in Simulink/MATLAB.
What I found but not for .sldd objects:
For example, An SLX file activeSuspension.slx’s matlab version it has been saved in can be retrieved using Simulink.MDLInfo object and it’s property ‘ReleaseName’.
mdlInfo= Simulink.MDLInfo(‘activeSuspension’);
matlabVersion=mdlInfo.ReleaseName;
From documentation https://in.mathworks.com/help/simulink/slref/simulink.mdlinfo.html I am aware that MDLInfo is only limited to .slx,.slxp and .mdl files.
My Query:
Now coming to my query, I would like to know if there is any direct API command like MDLInfo or a resuable script available to get the matlab version created for a .sldd file.
Since the metadata is visible in MATLAB UI for a .sldd file I believe there is a solid possibility to have an API command from which the "Saved in Simulink " version can be found, but I am unlucky so far to find one from documentation. Thanks in advance.I am now creating a MATLAB script to read the release versions in which a .sldd object is created in Simulink/MATLAB.
What I found but not for .sldd objects:
For example, An SLX file activeSuspension.slx’s matlab version it has been saved in can be retrieved using Simulink.MDLInfo object and it’s property ‘ReleaseName’.
mdlInfo= Simulink.MDLInfo(‘activeSuspension’);
matlabVersion=mdlInfo.ReleaseName;
From documentation https://in.mathworks.com/help/simulink/slref/simulink.mdlinfo.html I am aware that MDLInfo is only limited to .slx,.slxp and .mdl files.
My Query:
Now coming to my query, I would like to know if there is any direct API command like MDLInfo or a resuable script available to get the matlab version created for a .sldd file.
Since the metadata is visible in MATLAB UI for a .sldd file I believe there is a solid possibility to have an API command from which the "Saved in Simulink " version can be found, but I am unlucky so far to find one from documentation. Thanks in advance. I am now creating a MATLAB script to read the release versions in which a .sldd object is created in Simulink/MATLAB.
What I found but not for .sldd objects:
For example, An SLX file activeSuspension.slx’s matlab version it has been saved in can be retrieved using Simulink.MDLInfo object and it’s property ‘ReleaseName’.
mdlInfo= Simulink.MDLInfo(‘activeSuspension’);
matlabVersion=mdlInfo.ReleaseName;
From documentation https://in.mathworks.com/help/simulink/slref/simulink.mdlinfo.html I am aware that MDLInfo is only limited to .slx,.slxp and .mdl files.
My Query:
Now coming to my query, I would like to know if there is any direct API command like MDLInfo or a resuable script available to get the matlab version created for a .sldd file.
Since the metadata is visible in MATLAB UI for a .sldd file I believe there is a solid possibility to have an API command from which the "Saved in Simulink " version can be found, but I am unlucky so far to find one from documentation. Thanks in advance. #sldd, api, mdlinfo, saved in simulink version MATLAB Answers — New Questions
Suggestions for Implementing Specific Generative AI Models in MATLAB
I am deeply interested in the field of generative AI, particularly in models like GANs (Generative Adversarial Networks). I’m looking to implement a simple GAN model for image generation in MATLAB. Could anyone provide specific guidance or best practices on how to design and train a GAN? Any suggestions regarding GAN architectures in MATLAB would also be greatly appreciated.
Thanks:)I am deeply interested in the field of generative AI, particularly in models like GANs (Generative Adversarial Networks). I’m looking to implement a simple GAN model for image generation in MATLAB. Could anyone provide specific guidance or best practices on how to design and train a GAN? Any suggestions regarding GAN architectures in MATLAB would also be greatly appreciated.
Thanks:) I am deeply interested in the field of generative AI, particularly in models like GANs (Generative Adversarial Networks). I’m looking to implement a simple GAN model for image generation in MATLAB. Could anyone provide specific guidance or best practices on how to design and train a GAN? Any suggestions regarding GAN architectures in MATLAB would also be greatly appreciated.
Thanks:) gan, generative ai, model design MATLAB Answers — New Questions
How to display the volume of a masked volume?
For a 3D image or a stack of 2D images stored in a matrix format (Nx, Ny, Nz), there is a corresponding mask image of the same size that defines a 3D volume within the 3D image. How can I display only this masked volume using volshow or other functions to visualize the volume? Thank you.For a 3D image or a stack of 2D images stored in a matrix format (Nx, Ny, Nz), there is a corresponding mask image of the same size that defines a 3D volume within the 3D image. How can I display only this masked volume using volshow or other functions to visualize the volume? Thank you. For a 3D image or a stack of 2D images stored in a matrix format (Nx, Ny, Nz), there is a corresponding mask image of the same size that defines a 3D volume within the 3D image. How can I display only this masked volume using volshow or other functions to visualize the volume? Thank you. volshow, 3d image, display, matlab compiler MATLAB Answers — New Questions
how to apply wavelet and extract the features from speech signal
Hi everyone i am doing my project in "Word spotting in continuous speech using wavelet transform"
i want matlab code to perform wavelet transform and feature extraction. please any one help me…Hi everyone i am doing my project in "Word spotting in continuous speech using wavelet transform"
i want matlab code to perform wavelet transform and feature extraction. please any one help me… Hi everyone i am doing my project in "Word spotting in continuous speech using wavelet transform"
i want matlab code to perform wavelet transform and feature extraction. please any one help me… wavelet, feature extraction MATLAB Answers — New Questions
PWM DUTY CYCLE SIMULINK
I have been working on nxp s32k312 microcontroller board, currently i am facing issue with the pwm duty cycle.
in the below image i am unable to change the pwm duty in the simulink model even though the generated c code seems to have it in place. Can some explain please. I have uploaded the model file(zip)I have been working on nxp s32k312 microcontroller board, currently i am facing issue with the pwm duty cycle.
in the below image i am unable to change the pwm duty in the simulink model even though the generated c code seems to have it in place. Can some explain please. I have uploaded the model file(zip) I have been working on nxp s32k312 microcontroller board, currently i am facing issue with the pwm duty cycle.
in the below image i am unable to change the pwm duty in the simulink model even though the generated c code seems to have it in place. Can some explain please. I have uploaded the model file(zip) pwm duty cycle MATLAB Answers — New Questions