Category: Matlab
Category Archives: Matlab
Issues with looping in structure: variable in the name
I am loading one Excel spreadsheet with 11 tabs. The 11 tabs are named fl1, fl2,… fl11.
The spreadsheet is currently loaded into a structure named flight_data. I don’t like the way it is organized, so I want to create a 11 new structures: somename1, somename2,….somename11.
I think the code will show how I’m trying to structure my data. The goal is to have 11 strutures that look like this:
%my loop that doesn’t work
for i = 1:11
fpro(i).loc7.x = flight_data.fpro{i}(:,1)
end
%my structure setup
fpro(i).name = ‘Flight Profile {i}’;
fpro(i).loc7.x = flight_data.fl{i}(:,1)
fpro(i).loc9.x = flight_data.fl{i}(:,4)
fpro(i).loc10.x = flight_data.fl{i}(:,7)
fpro(i).loc7.y = flight_data.fl{i}(:,2)
fpro(i).loc9.y = flight_data.fl{i}(:,5)
fpro(i).loc10.y = flight_data.fl{i}(:,8)
fpro(i).loc7.z = flight_data.fl{i}(:,3)
fpro(i).loc9.z = flight_data.fl{i}(:,6)
fpro(i).loc10.z = flight_data.fl{i}(:,9)I am loading one Excel spreadsheet with 11 tabs. The 11 tabs are named fl1, fl2,… fl11.
The spreadsheet is currently loaded into a structure named flight_data. I don’t like the way it is organized, so I want to create a 11 new structures: somename1, somename2,….somename11.
I think the code will show how I’m trying to structure my data. The goal is to have 11 strutures that look like this:
%my loop that doesn’t work
for i = 1:11
fpro(i).loc7.x = flight_data.fpro{i}(:,1)
end
%my structure setup
fpro(i).name = ‘Flight Profile {i}’;
fpro(i).loc7.x = flight_data.fl{i}(:,1)
fpro(i).loc9.x = flight_data.fl{i}(:,4)
fpro(i).loc10.x = flight_data.fl{i}(:,7)
fpro(i).loc7.y = flight_data.fl{i}(:,2)
fpro(i).loc9.y = flight_data.fl{i}(:,5)
fpro(i).loc10.y = flight_data.fl{i}(:,8)
fpro(i).loc7.z = flight_data.fl{i}(:,3)
fpro(i).loc9.z = flight_data.fl{i}(:,6)
fpro(i).loc10.z = flight_data.fl{i}(:,9) I am loading one Excel spreadsheet with 11 tabs. The 11 tabs are named fl1, fl2,… fl11.
The spreadsheet is currently loaded into a structure named flight_data. I don’t like the way it is organized, so I want to create a 11 new structures: somename1, somename2,….somename11.
I think the code will show how I’m trying to structure my data. The goal is to have 11 strutures that look like this:
%my loop that doesn’t work
for i = 1:11
fpro(i).loc7.x = flight_data.fpro{i}(:,1)
end
%my structure setup
fpro(i).name = ‘Flight Profile {i}’;
fpro(i).loc7.x = flight_data.fl{i}(:,1)
fpro(i).loc9.x = flight_data.fl{i}(:,4)
fpro(i).loc10.x = flight_data.fl{i}(:,7)
fpro(i).loc7.y = flight_data.fl{i}(:,2)
fpro(i).loc9.y = flight_data.fl{i}(:,5)
fpro(i).loc10.y = flight_data.fl{i}(:,8)
fpro(i).loc7.z = flight_data.fl{i}(:,3)
fpro(i).loc9.z = flight_data.fl{i}(:,6)
fpro(i).loc10.z = flight_data.fl{i}(:,9) for, structures, sytax MATLAB Answers — New Questions
Getting error message when running Runge Kutta solution…
The code that produces the errors is below:
clc;
mass = 13.5;
Jx = 0.8244;
Jy = 1.135;
Jz = 1.759;
Jxz = 0.1204;
G = Jx*Jz-Jxz^2;
G1 = Jxz*(Jx – Jy + Jz)/G;
G2 = (Jz*(Jz-Jy)+Jxz^2)/G;
G3 = Jz/G;
G4 = Jxz/G;
G5 = (Jz-Jx)/Jy;
G6 = Jxz/Jy;
G7 = ((Jx-Jy)*Jx +Jxz^2)/G;
G8 = (Jx/G);
p = 0;
q = 0;
r = 0;
l = 0.0000;
m = 0.0000;
n = 0.0000;
tspan = [0 10];
%[t,q] = ode45(@(t,q) (G5*p*r-G6*(p^2-r^2)+m/Jy), tspan,0);
%plot(t,q);
%pdot = (G1*p*q-G2*q*r + G3*l+G4*n);
[t,p]=ode45(@(t,p) (G1*p*q – G2*q*r + G3*l + G4*n),[0 10], 0.1);
plot(t,p,’–r’);
disp(p);
disp(t);
[t,q] = ode45(@(t,r) (G5*p*r – G6*p*p – G6*r*r + m/Jy), [0 10],0);
plot(t,q,’–g’);
[t,r] = ode45(@(t,r) (G7*p*q – G1*q*r + G4*l + G8*n), [0 10],0);
plot(t,r,’–b’)
The output with the error messages follows:
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0
0.2500
0.5000
0.7500
1.0000
1.2500
1.5000
1.7500
2.0000
2.2500
2.5000
2.7500
3.0000
3.2500
3.5000
3.7500
4.0000
4.2500
4.5000
4.7500
5.0000
5.2500
5.5000
5.7500
6.0000
6.2500
6.5000
6.7500
7.0000
7.2500
7.5000
7.7500
8.0000
8.2500
8.5000
8.7500
9.0000
9.2500
9.5000
9.7500
10.0000
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To
perform elementwise multiplication, use ‘.*’.
Error in test>@(t,r)(G5*p*r-G6*p*p-G6*r*r+m/Jy) (line 30)
[t,q] = ode45(@(t,r) (G5*p*r – G6*p*p – G6*r*r + m/Jy), [0 10],0);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in test (line 30)
[t,q] = ode45(@(t,r) (G5*p*r – G6*p*p – G6*r*r + m/Jy), [0 10],0);The code that produces the errors is below:
clc;
mass = 13.5;
Jx = 0.8244;
Jy = 1.135;
Jz = 1.759;
Jxz = 0.1204;
G = Jx*Jz-Jxz^2;
G1 = Jxz*(Jx – Jy + Jz)/G;
G2 = (Jz*(Jz-Jy)+Jxz^2)/G;
G3 = Jz/G;
G4 = Jxz/G;
G5 = (Jz-Jx)/Jy;
G6 = Jxz/Jy;
G7 = ((Jx-Jy)*Jx +Jxz^2)/G;
G8 = (Jx/G);
p = 0;
q = 0;
r = 0;
l = 0.0000;
m = 0.0000;
n = 0.0000;
tspan = [0 10];
%[t,q] = ode45(@(t,q) (G5*p*r-G6*(p^2-r^2)+m/Jy), tspan,0);
%plot(t,q);
%pdot = (G1*p*q-G2*q*r + G3*l+G4*n);
[t,p]=ode45(@(t,p) (G1*p*q – G2*q*r + G3*l + G4*n),[0 10], 0.1);
plot(t,p,’–r’);
disp(p);
disp(t);
[t,q] = ode45(@(t,r) (G5*p*r – G6*p*p – G6*r*r + m/Jy), [0 10],0);
plot(t,q,’–g’);
[t,r] = ode45(@(t,r) (G7*p*q – G1*q*r + G4*l + G8*n), [0 10],0);
plot(t,r,’–b’)
The output with the error messages follows:
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0
0.2500
0.5000
0.7500
1.0000
1.2500
1.5000
1.7500
2.0000
2.2500
2.5000
2.7500
3.0000
3.2500
3.5000
3.7500
4.0000
4.2500
4.5000
4.7500
5.0000
5.2500
5.5000
5.7500
6.0000
6.2500
6.5000
6.7500
7.0000
7.2500
7.5000
7.7500
8.0000
8.2500
8.5000
8.7500
9.0000
9.2500
9.5000
9.7500
10.0000
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To
perform elementwise multiplication, use ‘.*’.
Error in test>@(t,r)(G5*p*r-G6*p*p-G6*r*r+m/Jy) (line 30)
[t,q] = ode45(@(t,r) (G5*p*r – G6*p*p – G6*r*r + m/Jy), [0 10],0);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in test (line 30)
[t,q] = ode45(@(t,r) (G5*p*r – G6*p*p – G6*r*r + m/Jy), [0 10],0); The code that produces the errors is below:
clc;
mass = 13.5;
Jx = 0.8244;
Jy = 1.135;
Jz = 1.759;
Jxz = 0.1204;
G = Jx*Jz-Jxz^2;
G1 = Jxz*(Jx – Jy + Jz)/G;
G2 = (Jz*(Jz-Jy)+Jxz^2)/G;
G3 = Jz/G;
G4 = Jxz/G;
G5 = (Jz-Jx)/Jy;
G6 = Jxz/Jy;
G7 = ((Jx-Jy)*Jx +Jxz^2)/G;
G8 = (Jx/G);
p = 0;
q = 0;
r = 0;
l = 0.0000;
m = 0.0000;
n = 0.0000;
tspan = [0 10];
%[t,q] = ode45(@(t,q) (G5*p*r-G6*(p^2-r^2)+m/Jy), tspan,0);
%plot(t,q);
%pdot = (G1*p*q-G2*q*r + G3*l+G4*n);
[t,p]=ode45(@(t,p) (G1*p*q – G2*q*r + G3*l + G4*n),[0 10], 0.1);
plot(t,p,’–r’);
disp(p);
disp(t);
[t,q] = ode45(@(t,r) (G5*p*r – G6*p*p – G6*r*r + m/Jy), [0 10],0);
plot(t,q,’–g’);
[t,r] = ode45(@(t,r) (G7*p*q – G1*q*r + G4*l + G8*n), [0 10],0);
plot(t,r,’–b’)
The output with the error messages follows:
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0.1000
0
0.2500
0.5000
0.7500
1.0000
1.2500
1.5000
1.7500
2.0000
2.2500
2.5000
2.7500
3.0000
3.2500
3.5000
3.7500
4.0000
4.2500
4.5000
4.7500
5.0000
5.2500
5.5000
5.7500
6.0000
6.2500
6.5000
6.7500
7.0000
7.2500
7.5000
7.7500
8.0000
8.2500
8.5000
8.7500
9.0000
9.2500
9.5000
9.7500
10.0000
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To
perform elementwise multiplication, use ‘.*’.
Error in test>@(t,r)(G5*p*r-G6*p*p-G6*r*r+m/Jy) (line 30)
[t,q] = ode45(@(t,r) (G5*p*r – G6*p*p – G6*r*r + m/Jy), [0 10],0);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in test (line 30)
[t,q] = ode45(@(t,r) (G5*p*r – G6*p*p – G6*r*r + m/Jy), [0 10],0); runge kutta 4, errors MATLAB Answers — New Questions
Why does MATLAB crash on Linux with “Inconsistency detected by ld.so: ../elf/dl-tls.c: 597: _dl_allocate_tls_init:”
When I run MATLAB R2021b on my Linux machine, it occasionally crashes. The following error message appears in the terminal or at the top of the resulting crash stack trace:
Inconsistency detected by ld.so: ../elf/dl-tls.c: 597: _dl_allocate_tls_init: Assertion `listp != NULL’ failed!
This crash primarily happens when I attempt to use Simulink for the first time after launching MATLAB.When I run MATLAB R2021b on my Linux machine, it occasionally crashes. The following error message appears in the terminal or at the top of the resulting crash stack trace:
Inconsistency detected by ld.so: ../elf/dl-tls.c: 597: _dl_allocate_tls_init: Assertion `listp != NULL’ failed!
This crash primarily happens when I attempt to use Simulink for the first time after launching MATLAB. When I run MATLAB R2021b on my Linux machine, it occasionally crashes. The following error message appears in the terminal or at the top of the resulting crash stack trace:
Inconsistency detected by ld.so: ../elf/dl-tls.c: 597: _dl_allocate_tls_init: Assertion `listp != NULL’ failed!
This crash primarily happens when I attempt to use Simulink for the first time after launching MATLAB. crash, libc, linux, glibc MATLAB Answers — New Questions
too many open files even after adding fclose within my for loop
As the title says, I am receiving an error saying I have too many open files. I did look into it (via MatlabCentral) and attempted to fix it by adding ‘fclose’ after each ‘fopen.’ I am adding my for loop below. I included the first line of my code (readmatrix), but did not include the lines defining the variables because there are too many. What am I doing wrong here?
Thanks.
m=readmatrix(‘vertebrae_points_idno.xlsx’);
%%did not include lines defining my variables%%
for i=1:length(m)
for j=1:length(m(:,1))
conversion=conversion_array(j);
%combines variables into matrices for saving and printing.
[c1,c2,c3,c4,c5,c6,c7]=matrix_combine(c1x(i,:),c1y(i,:),c2x(i,:),c2y(i,:),c3x(i,:),c3y(i,:),c4x(i,:),c4y(i,:),c5x(i,:),c5y(i,:),c6x(i,:),c6y(i,:),c7x(i,:),c7y(i,:));
%calculate centroids.
[c2_centroid,c3_centroid,c4_centroid,c5_centroid,c6_centroid,c7_centroid]=get_centroids(c2,c3,c4,c5,c6,c7);
%generate "ideal" arc
[line_x,line_y,x,y,C]=generate_arc(c2,c3,c4,c5,c6,c7);
%transpose for CircleFit
arc_xy=[line_x.’ line_y.’];
%gather points of circle from vertebral points
Par=CircleFit(arc_xy);
%generate actual arc and plot
[x2,y2,true_lord_angle]=generate_second_arc(c2,c7,Par);
%calculate distance between two arcs
[converted_curve_dist,converted_max_curve_dist]=get_curve_distance(x,y,x2,y2,conversion);
%calculates extension angles
[c1_c7_angle,c2_c7_angle,c2c3_tangent,c3c4_tangent,c4c5_tangent,c5c6_tangent,c6c7_tangent]=rotation_angles(line_x,line_y,c1,c2,c3,c4,c5,c6,c7);
%closes image so the program can create another image with centroids.
close all
%calculates SVA, determines type of kyphosis, plots centroids and C2-C7 centroid line.
[kyphosis_type,sva_axis]=kyphosis_sva_new(c7,c2_centroid,c3_centroid,c4_centroid,c5_centroid,c6_centroid,c7_centroid, conversion);
spine_data=[converted_curve_dist,converted_max_curve_dist,sva_axis,true_lord_angle,c1_c7_angle,c2_c7_angle];
opening_name=’spine_xray_data.txt’;
opening_name2=’translation_angles.txt’;
fid=fopen(opening_name,’w’);
fprintf(fid,’n %10ft %10.2ft %10.2ft %10.2ft %10.2ft %10.2ft %10.2ft %10st %10.4f’,…
sub_id, spine_data,kyphosis_type,conversion);
fclose(fid);
fid2=fopen(opening_name2,’w’);
fprintf(fid2,’n %10.4ft %10.4ft %10.4ft %10.4ft %10.4f’,…
c2c3_tangent,c3c4_tangent,c4c5_tangent,c5c6_tangent,c6c7_tangent);
fclose(fid2);
end
endAs the title says, I am receiving an error saying I have too many open files. I did look into it (via MatlabCentral) and attempted to fix it by adding ‘fclose’ after each ‘fopen.’ I am adding my for loop below. I included the first line of my code (readmatrix), but did not include the lines defining the variables because there are too many. What am I doing wrong here?
Thanks.
m=readmatrix(‘vertebrae_points_idno.xlsx’);
%%did not include lines defining my variables%%
for i=1:length(m)
for j=1:length(m(:,1))
conversion=conversion_array(j);
%combines variables into matrices for saving and printing.
[c1,c2,c3,c4,c5,c6,c7]=matrix_combine(c1x(i,:),c1y(i,:),c2x(i,:),c2y(i,:),c3x(i,:),c3y(i,:),c4x(i,:),c4y(i,:),c5x(i,:),c5y(i,:),c6x(i,:),c6y(i,:),c7x(i,:),c7y(i,:));
%calculate centroids.
[c2_centroid,c3_centroid,c4_centroid,c5_centroid,c6_centroid,c7_centroid]=get_centroids(c2,c3,c4,c5,c6,c7);
%generate "ideal" arc
[line_x,line_y,x,y,C]=generate_arc(c2,c3,c4,c5,c6,c7);
%transpose for CircleFit
arc_xy=[line_x.’ line_y.’];
%gather points of circle from vertebral points
Par=CircleFit(arc_xy);
%generate actual arc and plot
[x2,y2,true_lord_angle]=generate_second_arc(c2,c7,Par);
%calculate distance between two arcs
[converted_curve_dist,converted_max_curve_dist]=get_curve_distance(x,y,x2,y2,conversion);
%calculates extension angles
[c1_c7_angle,c2_c7_angle,c2c3_tangent,c3c4_tangent,c4c5_tangent,c5c6_tangent,c6c7_tangent]=rotation_angles(line_x,line_y,c1,c2,c3,c4,c5,c6,c7);
%closes image so the program can create another image with centroids.
close all
%calculates SVA, determines type of kyphosis, plots centroids and C2-C7 centroid line.
[kyphosis_type,sva_axis]=kyphosis_sva_new(c7,c2_centroid,c3_centroid,c4_centroid,c5_centroid,c6_centroid,c7_centroid, conversion);
spine_data=[converted_curve_dist,converted_max_curve_dist,sva_axis,true_lord_angle,c1_c7_angle,c2_c7_angle];
opening_name=’spine_xray_data.txt’;
opening_name2=’translation_angles.txt’;
fid=fopen(opening_name,’w’);
fprintf(fid,’n %10ft %10.2ft %10.2ft %10.2ft %10.2ft %10.2ft %10.2ft %10st %10.4f’,…
sub_id, spine_data,kyphosis_type,conversion);
fclose(fid);
fid2=fopen(opening_name2,’w’);
fprintf(fid2,’n %10.4ft %10.4ft %10.4ft %10.4ft %10.4f’,…
c2c3_tangent,c3c4_tangent,c4c5_tangent,c5c6_tangent,c6c7_tangent);
fclose(fid2);
end
end As the title says, I am receiving an error saying I have too many open files. I did look into it (via MatlabCentral) and attempted to fix it by adding ‘fclose’ after each ‘fopen.’ I am adding my for loop below. I included the first line of my code (readmatrix), but did not include the lines defining the variables because there are too many. What am I doing wrong here?
Thanks.
m=readmatrix(‘vertebrae_points_idno.xlsx’);
%%did not include lines defining my variables%%
for i=1:length(m)
for j=1:length(m(:,1))
conversion=conversion_array(j);
%combines variables into matrices for saving and printing.
[c1,c2,c3,c4,c5,c6,c7]=matrix_combine(c1x(i,:),c1y(i,:),c2x(i,:),c2y(i,:),c3x(i,:),c3y(i,:),c4x(i,:),c4y(i,:),c5x(i,:),c5y(i,:),c6x(i,:),c6y(i,:),c7x(i,:),c7y(i,:));
%calculate centroids.
[c2_centroid,c3_centroid,c4_centroid,c5_centroid,c6_centroid,c7_centroid]=get_centroids(c2,c3,c4,c5,c6,c7);
%generate "ideal" arc
[line_x,line_y,x,y,C]=generate_arc(c2,c3,c4,c5,c6,c7);
%transpose for CircleFit
arc_xy=[line_x.’ line_y.’];
%gather points of circle from vertebral points
Par=CircleFit(arc_xy);
%generate actual arc and plot
[x2,y2,true_lord_angle]=generate_second_arc(c2,c7,Par);
%calculate distance between two arcs
[converted_curve_dist,converted_max_curve_dist]=get_curve_distance(x,y,x2,y2,conversion);
%calculates extension angles
[c1_c7_angle,c2_c7_angle,c2c3_tangent,c3c4_tangent,c4c5_tangent,c5c6_tangent,c6c7_tangent]=rotation_angles(line_x,line_y,c1,c2,c3,c4,c5,c6,c7);
%closes image so the program can create another image with centroids.
close all
%calculates SVA, determines type of kyphosis, plots centroids and C2-C7 centroid line.
[kyphosis_type,sva_axis]=kyphosis_sva_new(c7,c2_centroid,c3_centroid,c4_centroid,c5_centroid,c6_centroid,c7_centroid, conversion);
spine_data=[converted_curve_dist,converted_max_curve_dist,sva_axis,true_lord_angle,c1_c7_angle,c2_c7_angle];
opening_name=’spine_xray_data.txt’;
opening_name2=’translation_angles.txt’;
fid=fopen(opening_name,’w’);
fprintf(fid,’n %10ft %10.2ft %10.2ft %10.2ft %10.2ft %10.2ft %10.2ft %10st %10.4f’,…
sub_id, spine_data,kyphosis_type,conversion);
fclose(fid);
fid2=fopen(opening_name2,’w’);
fprintf(fid2,’n %10.4ft %10.4ft %10.4ft %10.4ft %10.4f’,…
c2c3_tangent,c3c4_tangent,c4c5_tangent,c5c6_tangent,c6c7_tangent);
fclose(fid2);
end
end error, fclose, fopen MATLAB Answers — New Questions
are there motor resolver models out there?
Has anyone modeled a dc motor and resolver in multibody or other? Looking for an example rather brute force attempting including learning curve.Has anyone modeled a dc motor and resolver in multibody or other? Looking for an example rather brute force attempting including learning curve. Has anyone modeled a dc motor and resolver in multibody or other? Looking for an example rather brute force attempting including learning curve. resolver MATLAB Answers — New Questions
Don’t understand the reason this code is giving me errors.
The code that is producing the error is below. It says:
>> test
Error: File: test.m Line: 32 Column: 58
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
>> test
Error: File: test.m Line: 30 Column: 60
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
Code that produces errors is below.
clc;
mass = 13.5;
Jx = 0.8244;
Jy = 1.135;
Jz = 1.759;
Jxz = 0.1204;
G = Jx*Jz-Jxz^2;
G1 = Jxz*(Jx – Jy + Jz)/G;
G2 = (Jz*(Jz-Jy)+Jxz^2)/G;
G3 = Jz/G;
G4 = Jxz/G;
G5 = (Jz-Jx)/Jy;
G6 = Jxz/Jy;
G7 = ((Jx-Jy)*Jx +Jxz^2)/G;
G8 = (Jx/G);
p = 0;
q = 0;
r = 0;
l = 0.0000;
m = 0.0000;
n = 0.0000;
tspan = [0 10];
%[t,q] = ode45(@(t,q) (G5*p*r-G6*(p^2-r^2)+m/Jy), tspan,0);
%plot(t,q);
%pdot = (G1*p*q-G2*q*r + G3*l+G4*n);
[t,p]=ode45(@(t,p) (G1*p*q-G2*q*r+G3*l+G4*n),[0 10], 0.1);
plot(t,p,’–r’);
disp(p);
disp(t);
[t,q] = ode45(@(t,r) (G5*p*r-G6*p*p-G6*r*r)+m/Jy), [0 10],0);
plot(t,q,’–g’);
[t,r] = ode45(@(t,r) (G7*p*q-G1*q*r + G4*l+G8*n), [0 10],0);
plot(t,r,’–b’)The code that is producing the error is below. It says:
>> test
Error: File: test.m Line: 32 Column: 58
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
>> test
Error: File: test.m Line: 30 Column: 60
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
Code that produces errors is below.
clc;
mass = 13.5;
Jx = 0.8244;
Jy = 1.135;
Jz = 1.759;
Jxz = 0.1204;
G = Jx*Jz-Jxz^2;
G1 = Jxz*(Jx – Jy + Jz)/G;
G2 = (Jz*(Jz-Jy)+Jxz^2)/G;
G3 = Jz/G;
G4 = Jxz/G;
G5 = (Jz-Jx)/Jy;
G6 = Jxz/Jy;
G7 = ((Jx-Jy)*Jx +Jxz^2)/G;
G8 = (Jx/G);
p = 0;
q = 0;
r = 0;
l = 0.0000;
m = 0.0000;
n = 0.0000;
tspan = [0 10];
%[t,q] = ode45(@(t,q) (G5*p*r-G6*(p^2-r^2)+m/Jy), tspan,0);
%plot(t,q);
%pdot = (G1*p*q-G2*q*r + G3*l+G4*n);
[t,p]=ode45(@(t,p) (G1*p*q-G2*q*r+G3*l+G4*n),[0 10], 0.1);
plot(t,p,’–r’);
disp(p);
disp(t);
[t,q] = ode45(@(t,r) (G5*p*r-G6*p*p-G6*r*r)+m/Jy), [0 10],0);
plot(t,q,’–g’);
[t,r] = ode45(@(t,r) (G7*p*q-G1*q*r + G4*l+G8*n), [0 10],0);
plot(t,r,’–b’) The code that is producing the error is below. It says:
>> test
Error: File: test.m Line: 32 Column: 58
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
>> test
Error: File: test.m Line: 30 Column: 60
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
Code that produces errors is below.
clc;
mass = 13.5;
Jx = 0.8244;
Jy = 1.135;
Jz = 1.759;
Jxz = 0.1204;
G = Jx*Jz-Jxz^2;
G1 = Jxz*(Jx – Jy + Jz)/G;
G2 = (Jz*(Jz-Jy)+Jxz^2)/G;
G3 = Jz/G;
G4 = Jxz/G;
G5 = (Jz-Jx)/Jy;
G6 = Jxz/Jy;
G7 = ((Jx-Jy)*Jx +Jxz^2)/G;
G8 = (Jx/G);
p = 0;
q = 0;
r = 0;
l = 0.0000;
m = 0.0000;
n = 0.0000;
tspan = [0 10];
%[t,q] = ode45(@(t,q) (G5*p*r-G6*(p^2-r^2)+m/Jy), tspan,0);
%plot(t,q);
%pdot = (G1*p*q-G2*q*r + G3*l+G4*n);
[t,p]=ode45(@(t,p) (G1*p*q-G2*q*r+G3*l+G4*n),[0 10], 0.1);
plot(t,p,’–r’);
disp(p);
disp(t);
[t,q] = ode45(@(t,r) (G5*p*r-G6*p*p-G6*r*r)+m/Jy), [0 10],0);
plot(t,q,’–g’);
[t,r] = ode45(@(t,r) (G7*p*q-G1*q*r + G4*l+G8*n), [0 10],0);
plot(t,r,’–b’) error in calling runge kutta 4 function. MATLAB Answers — New Questions
Bus selector cannot find signals where the name has been changed programmatically?
Hi,
I programmatically need to change signal names in simulink.
I use a code similar to:
lineH = find_system(gcs, ‘FindAll’, ‘on’, ‘type’, ‘line’);
set(lineH, ‘Name’, ‘NewName’);
So far so good, but when the changed signal is fed into a bus and should then be selected with a bus selector block, the selector block does not find the "NewName".
I would need to manually open the bus selector block and select the "NewName". Problem is, that there are hundrets of signals to be changed and even much more bus selectors, where the change needs then to be done manually.
Interresting is, that if a signal name change in Simulink is done manually, the bus selectors are somehow updated and the "NewName" is detected automatically without the need of selecting the signal in the respective bus selectors.
Has anyone a solution for this problem?
It would be nice, if there was a built in matlab/simulink function that can automatically update all bus selectors after a programmatically performed signal name change?
Thanks for you help.
ThomasHi,
I programmatically need to change signal names in simulink.
I use a code similar to:
lineH = find_system(gcs, ‘FindAll’, ‘on’, ‘type’, ‘line’);
set(lineH, ‘Name’, ‘NewName’);
So far so good, but when the changed signal is fed into a bus and should then be selected with a bus selector block, the selector block does not find the "NewName".
I would need to manually open the bus selector block and select the "NewName". Problem is, that there are hundrets of signals to be changed and even much more bus selectors, where the change needs then to be done manually.
Interresting is, that if a signal name change in Simulink is done manually, the bus selectors are somehow updated and the "NewName" is detected automatically without the need of selecting the signal in the respective bus selectors.
Has anyone a solution for this problem?
It would be nice, if there was a built in matlab/simulink function that can automatically update all bus selectors after a programmatically performed signal name change?
Thanks for you help.
Thomas Hi,
I programmatically need to change signal names in simulink.
I use a code similar to:
lineH = find_system(gcs, ‘FindAll’, ‘on’, ‘type’, ‘line’);
set(lineH, ‘Name’, ‘NewName’);
So far so good, but when the changed signal is fed into a bus and should then be selected with a bus selector block, the selector block does not find the "NewName".
I would need to manually open the bus selector block and select the "NewName". Problem is, that there are hundrets of signals to be changed and even much more bus selectors, where the change needs then to be done manually.
Interresting is, that if a signal name change in Simulink is done manually, the bus selectors are somehow updated and the "NewName" is detected automatically without the need of selecting the signal in the respective bus selectors.
Has anyone a solution for this problem?
It would be nice, if there was a built in matlab/simulink function that can automatically update all bus selectors after a programmatically performed signal name change?
Thanks for you help.
Thomas busselector, bus selector, programmatically, signal name change programmatically, signal name change, programmatically change simulink signal name, signal name change with m script MATLAB Answers — New Questions
Converting cell array with elements to numerical or double matrix
I have to import a cell array that is composed of strings and numbers from excel to MATLAB using readcell, and one part of the larger input data that is of interest to me is an array with mostly numbers, and otherwise some strings in the first column and empty spaces in the numerical section that appear as <missing>. Usually, I used to do this using xlsread, but due to the increasing pressure by MATLAB to use its more specific functions for such operations, and also as it seems like the readcell function DOES work faster, I am trying to get familiar with readcell here.
I would like to treat the particular section of interest as a table with a numerical array, and it would be OK for me to e.g. convert the <missing> elements to number 0 in my final numerical matrix. Also keep in my mind that this section is just a small part of a much larger data file, and using readtable will not work.
Below is the code:
clc
InputData=readcell(‘MATLAB_readcell.xlsx’,"Sheet","Sample Data")
InputString=string(InputData)
Numbers=InputString(:,2:end)
[ii,jj]=find(ismissing(Numbers))
Numbers(ii,jj)=’0′
But here I have a problem: So far I can only convert the input to a string first, then look for <missing> in the resulting string array using ismissing, then replace those elements with a string zeor (as ‘0’), then convert the whole thing to a numerical array using str2num.
First of all, I assume there must be an easier way to do this, but regardless of that, the resulting numerical matrix here has saome faults, in that all the vales that appear as 70 in the string array, are equal to 0 in final matrix. In other words, although I want the program to only set the string value of every <missing> element with in particular ii&jj posiztion, it actually sets the whole row equal to ‘0’.
is there an easier way to do this and if not, how can I at least solve the problem with the faulty rows?I have to import a cell array that is composed of strings and numbers from excel to MATLAB using readcell, and one part of the larger input data that is of interest to me is an array with mostly numbers, and otherwise some strings in the first column and empty spaces in the numerical section that appear as <missing>. Usually, I used to do this using xlsread, but due to the increasing pressure by MATLAB to use its more specific functions for such operations, and also as it seems like the readcell function DOES work faster, I am trying to get familiar with readcell here.
I would like to treat the particular section of interest as a table with a numerical array, and it would be OK for me to e.g. convert the <missing> elements to number 0 in my final numerical matrix. Also keep in my mind that this section is just a small part of a much larger data file, and using readtable will not work.
Below is the code:
clc
InputData=readcell(‘MATLAB_readcell.xlsx’,"Sheet","Sample Data")
InputString=string(InputData)
Numbers=InputString(:,2:end)
[ii,jj]=find(ismissing(Numbers))
Numbers(ii,jj)=’0′
But here I have a problem: So far I can only convert the input to a string first, then look for <missing> in the resulting string array using ismissing, then replace those elements with a string zeor (as ‘0’), then convert the whole thing to a numerical array using str2num.
First of all, I assume there must be an easier way to do this, but regardless of that, the resulting numerical matrix here has saome faults, in that all the vales that appear as 70 in the string array, are equal to 0 in final matrix. In other words, although I want the program to only set the string value of every <missing> element with in particular ii&jj posiztion, it actually sets the whole row equal to ‘0’.
is there an easier way to do this and if not, how can I at least solve the problem with the faulty rows? I have to import a cell array that is composed of strings and numbers from excel to MATLAB using readcell, and one part of the larger input data that is of interest to me is an array with mostly numbers, and otherwise some strings in the first column and empty spaces in the numerical section that appear as <missing>. Usually, I used to do this using xlsread, but due to the increasing pressure by MATLAB to use its more specific functions for such operations, and also as it seems like the readcell function DOES work faster, I am trying to get familiar with readcell here.
I would like to treat the particular section of interest as a table with a numerical array, and it would be OK for me to e.g. convert the <missing> elements to number 0 in my final numerical matrix. Also keep in my mind that this section is just a small part of a much larger data file, and using readtable will not work.
Below is the code:
clc
InputData=readcell(‘MATLAB_readcell.xlsx’,"Sheet","Sample Data")
InputString=string(InputData)
Numbers=InputString(:,2:end)
[ii,jj]=find(ismissing(Numbers))
Numbers(ii,jj)=’0′
But here I have a problem: So far I can only convert the input to a string first, then look for <missing> in the resulting string array using ismissing, then replace those elements with a string zeor (as ‘0’), then convert the whole thing to a numerical array using str2num.
First of all, I assume there must be an easier way to do this, but regardless of that, the resulting numerical matrix here has saome faults, in that all the vales that appear as 70 in the string array, are equal to 0 in final matrix. In other words, although I want the program to only set the string value of every <missing> element with in particular ii&jj posiztion, it actually sets the whole row equal to ‘0’.
is there an easier way to do this and if not, how can I at least solve the problem with the faulty rows? readcell, str2num, reading cells, xlsread, excel input, string arrays, missing MATLAB Answers — New Questions
为什么我会收到”BLAS 加载错误: C:MATLAB7binwin32atlas_Athlon.dll: 找不到指定的模块。”,我下载的是Matlab2024a(D盘中),以前下载过另一款MATLAB(C盘)但删除了
clear
m0=1;
lamda=532*10^(-9);%lamda=[417,457,488,532,632.8]*10^(-9); %光束波长
z=50;%z=eps+[0:5:50]; %传播距离
R=0.03;%接受孔径的半径
A0=10;%光束功率常数
det=0.01:0.01:0.15; %横向相干长度
L=[1,5,10,20,30];%光总数指数
e=1*10^(-5);%e=[0.01,0.1,1,10,100]*10^(-5);%动能耗散率
X=1*10^(-8);% 温度耗5散
eta=0.001;% 内尺度因子
abc=3;%各项异性子
gama=-3;%温度盐度贡献比
NUM=10;
m=m0-NUM:1:m0+NUM;
k=2*pi/lamda;
for iiii=1:length(L)
C0=0;
for ll=1:L(iiii)
C0=C0+factorial(L(iiii))/factorial(ll)/factorial(L(iiii)-ll)*(-1)^(ll-1)/ll;
end
for iii=1:length(det)
for ii=1:length(m)
qtemp=0;
funt1=pi^2/(k*z)*(factorial(m0)*A0)^2/C0;
rouc2=8.705*10^(-8)*k^2*(e*eta)^(-1/3)*abc^(-2)*X*z*(1-2.605*gama^(-1)+7.007*gama^(-2));
for lll=1:L(iiii)
funt2=factorial(L(iiii))/(factorial(lll)*factorial(L(iiii)-lll))*(-1)^(lll-1)/lll;
fun=@(r) r.*funt1.*funt2.*(besselj(m0./2,k./4./z.*r.^2)).^2.*exp(-r.^2*(1./(lll.*det(iii).^2)+2.*rouc2))…
.*besseli(m(ii)-m0,(1./(lll.*det(iii).^2)+2.*rouc2).*r.^2);
qtemp=qtemp+integral(fun,0,R);
end
q(ii)=qtemp;
end
P(iiii,iii)=q(NUM+1)/sum(q);
end
end
figure
plot(det,P(1,:),’rs-‘);hold on
plot(det,P(2,:),’b+-‘);hold on
plot(det,P(3,:),’c*-‘);hold on
plot(det,P(4,:),’md-‘);hold on
plot(det,P(5,:),’g^-‘);
legend(‘L=1′,’L=5′,’L=10′,’L=20′,’L=30’)
%legend(‘λ=417nm’,’λ=457nm’,’λ=488nm’,’λ=532nm’,’λ=632.8nm’)
%legend(‘e=10^{-5}’,’e=3*10^{-5}’,’e=5*10^{-5}’,’e=7*10^{-5}’,’e=9*10^{-5}’)
xlabel(‘delta/m’);ylabel(‘P_{l_{0}}’);
axis([0.01,0.15,0.35,0.85]);hold on
demo1 = 0.35:0.1:0.85;
demo2 = [0.01,0.03,0.06,0.09,0.12,0.15];%demo2 = 0.01:0.02:0.1;
set(gca,’yTick’,demo1)
set(gca,’xTick’,demo2)
%xlabel(‘delta/m’);ylabel(‘P_{l_{0}}’);
%axis([0.01,0.1,0.35,0.85]);hold on
%demo1 = 0.35:0.1:0.85;
%demo2 = 0.01:0.02:0.1;
%set(gca,’yTick’,demo1)
%set(gca,’xTick’,demo2)
% [X0,Y0] = meshgrid(lamda,det);
% figure,surf(X0,Y0,P)
% %figure,bar3(P)
% xlabel(‘lamda’);ylabel(‘det’);zlabel(‘P_{m_{0}}’);hold on
>> MHBew_beamindex_hengxiangxiangganchagndu
BLAS: trying environment BLAS_VERSION…
BLAS: loading C:MATLAB7binwin32atlas_Athlon.dll
BLAS: unloading libraries
错误使用 *
BLAS 加载错误:
C:MATLAB7binwin32atlas_Athlon.dll: 找不到指定的模块。
出错 integralCalc>iterateScalarValued (第 330 行)
x = NODES*halfh + midpt; % NNODES x nsubs
出错 integralCalc>vadapt (第 148 行)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen, …
出错 integralCalc (第 77 行)
[q,errbnd] = vadapt(vfunAB,interval, …
出错 integral (第 87 行)
Q = integralCalc(fun,a,b,opstruct);
出错 MHBew_beamindex_hengxiangxiangganchagndu (第 36 行)
qtemp=qtemp+integral(fun,0,R);clear
m0=1;
lamda=532*10^(-9);%lamda=[417,457,488,532,632.8]*10^(-9); %光束波长
z=50;%z=eps+[0:5:50]; %传播距离
R=0.03;%接受孔径的半径
A0=10;%光束功率常数
det=0.01:0.01:0.15; %横向相干长度
L=[1,5,10,20,30];%光总数指数
e=1*10^(-5);%e=[0.01,0.1,1,10,100]*10^(-5);%动能耗散率
X=1*10^(-8);% 温度耗5散
eta=0.001;% 内尺度因子
abc=3;%各项异性子
gama=-3;%温度盐度贡献比
NUM=10;
m=m0-NUM:1:m0+NUM;
k=2*pi/lamda;
for iiii=1:length(L)
C0=0;
for ll=1:L(iiii)
C0=C0+factorial(L(iiii))/factorial(ll)/factorial(L(iiii)-ll)*(-1)^(ll-1)/ll;
end
for iii=1:length(det)
for ii=1:length(m)
qtemp=0;
funt1=pi^2/(k*z)*(factorial(m0)*A0)^2/C0;
rouc2=8.705*10^(-8)*k^2*(e*eta)^(-1/3)*abc^(-2)*X*z*(1-2.605*gama^(-1)+7.007*gama^(-2));
for lll=1:L(iiii)
funt2=factorial(L(iiii))/(factorial(lll)*factorial(L(iiii)-lll))*(-1)^(lll-1)/lll;
fun=@(r) r.*funt1.*funt2.*(besselj(m0./2,k./4./z.*r.^2)).^2.*exp(-r.^2*(1./(lll.*det(iii).^2)+2.*rouc2))…
.*besseli(m(ii)-m0,(1./(lll.*det(iii).^2)+2.*rouc2).*r.^2);
qtemp=qtemp+integral(fun,0,R);
end
q(ii)=qtemp;
end
P(iiii,iii)=q(NUM+1)/sum(q);
end
end
figure
plot(det,P(1,:),’rs-‘);hold on
plot(det,P(2,:),’b+-‘);hold on
plot(det,P(3,:),’c*-‘);hold on
plot(det,P(4,:),’md-‘);hold on
plot(det,P(5,:),’g^-‘);
legend(‘L=1′,’L=5′,’L=10′,’L=20′,’L=30’)
%legend(‘λ=417nm’,’λ=457nm’,’λ=488nm’,’λ=532nm’,’λ=632.8nm’)
%legend(‘e=10^{-5}’,’e=3*10^{-5}’,’e=5*10^{-5}’,’e=7*10^{-5}’,’e=9*10^{-5}’)
xlabel(‘delta/m’);ylabel(‘P_{l_{0}}’);
axis([0.01,0.15,0.35,0.85]);hold on
demo1 = 0.35:0.1:0.85;
demo2 = [0.01,0.03,0.06,0.09,0.12,0.15];%demo2 = 0.01:0.02:0.1;
set(gca,’yTick’,demo1)
set(gca,’xTick’,demo2)
%xlabel(‘delta/m’);ylabel(‘P_{l_{0}}’);
%axis([0.01,0.1,0.35,0.85]);hold on
%demo1 = 0.35:0.1:0.85;
%demo2 = 0.01:0.02:0.1;
%set(gca,’yTick’,demo1)
%set(gca,’xTick’,demo2)
% [X0,Y0] = meshgrid(lamda,det);
% figure,surf(X0,Y0,P)
% %figure,bar3(P)
% xlabel(‘lamda’);ylabel(‘det’);zlabel(‘P_{m_{0}}’);hold on
>> MHBew_beamindex_hengxiangxiangganchagndu
BLAS: trying environment BLAS_VERSION…
BLAS: loading C:MATLAB7binwin32atlas_Athlon.dll
BLAS: unloading libraries
错误使用 *
BLAS 加载错误:
C:MATLAB7binwin32atlas_Athlon.dll: 找不到指定的模块。
出错 integralCalc>iterateScalarValued (第 330 行)
x = NODES*halfh + midpt; % NNODES x nsubs
出错 integralCalc>vadapt (第 148 行)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen, …
出错 integralCalc (第 77 行)
[q,errbnd] = vadapt(vfunAB,interval, …
出错 integral (第 87 行)
Q = integralCalc(fun,a,b,opstruct);
出错 MHBew_beamindex_hengxiangxiangganchagndu (第 36 行)
qtemp=qtemp+integral(fun,0,R); clear
m0=1;
lamda=532*10^(-9);%lamda=[417,457,488,532,632.8]*10^(-9); %光束波长
z=50;%z=eps+[0:5:50]; %传播距离
R=0.03;%接受孔径的半径
A0=10;%光束功率常数
det=0.01:0.01:0.15; %横向相干长度
L=[1,5,10,20,30];%光总数指数
e=1*10^(-5);%e=[0.01,0.1,1,10,100]*10^(-5);%动能耗散率
X=1*10^(-8);% 温度耗5散
eta=0.001;% 内尺度因子
abc=3;%各项异性子
gama=-3;%温度盐度贡献比
NUM=10;
m=m0-NUM:1:m0+NUM;
k=2*pi/lamda;
for iiii=1:length(L)
C0=0;
for ll=1:L(iiii)
C0=C0+factorial(L(iiii))/factorial(ll)/factorial(L(iiii)-ll)*(-1)^(ll-1)/ll;
end
for iii=1:length(det)
for ii=1:length(m)
qtemp=0;
funt1=pi^2/(k*z)*(factorial(m0)*A0)^2/C0;
rouc2=8.705*10^(-8)*k^2*(e*eta)^(-1/3)*abc^(-2)*X*z*(1-2.605*gama^(-1)+7.007*gama^(-2));
for lll=1:L(iiii)
funt2=factorial(L(iiii))/(factorial(lll)*factorial(L(iiii)-lll))*(-1)^(lll-1)/lll;
fun=@(r) r.*funt1.*funt2.*(besselj(m0./2,k./4./z.*r.^2)).^2.*exp(-r.^2*(1./(lll.*det(iii).^2)+2.*rouc2))…
.*besseli(m(ii)-m0,(1./(lll.*det(iii).^2)+2.*rouc2).*r.^2);
qtemp=qtemp+integral(fun,0,R);
end
q(ii)=qtemp;
end
P(iiii,iii)=q(NUM+1)/sum(q);
end
end
figure
plot(det,P(1,:),’rs-‘);hold on
plot(det,P(2,:),’b+-‘);hold on
plot(det,P(3,:),’c*-‘);hold on
plot(det,P(4,:),’md-‘);hold on
plot(det,P(5,:),’g^-‘);
legend(‘L=1′,’L=5′,’L=10′,’L=20′,’L=30’)
%legend(‘λ=417nm’,’λ=457nm’,’λ=488nm’,’λ=532nm’,’λ=632.8nm’)
%legend(‘e=10^{-5}’,’e=3*10^{-5}’,’e=5*10^{-5}’,’e=7*10^{-5}’,’e=9*10^{-5}’)
xlabel(‘delta/m’);ylabel(‘P_{l_{0}}’);
axis([0.01,0.15,0.35,0.85]);hold on
demo1 = 0.35:0.1:0.85;
demo2 = [0.01,0.03,0.06,0.09,0.12,0.15];%demo2 = 0.01:0.02:0.1;
set(gca,’yTick’,demo1)
set(gca,’xTick’,demo2)
%xlabel(‘delta/m’);ylabel(‘P_{l_{0}}’);
%axis([0.01,0.1,0.35,0.85]);hold on
%demo1 = 0.35:0.1:0.85;
%demo2 = 0.01:0.02:0.1;
%set(gca,’yTick’,demo1)
%set(gca,’xTick’,demo2)
% [X0,Y0] = meshgrid(lamda,det);
% figure,surf(X0,Y0,P)
% %figure,bar3(P)
% xlabel(‘lamda’);ylabel(‘det’);zlabel(‘P_{m_{0}}’);hold on
>> MHBew_beamindex_hengxiangxiangganchagndu
BLAS: trying environment BLAS_VERSION…
BLAS: loading C:MATLAB7binwin32atlas_Athlon.dll
BLAS: unloading libraries
错误使用 *
BLAS 加载错误:
C:MATLAB7binwin32atlas_Athlon.dll: 找不到指定的模块。
出错 integralCalc>iterateScalarValued (第 330 行)
x = NODES*halfh + midpt; % NNODES x nsubs
出错 integralCalc>vadapt (第 148 行)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen, …
出错 integralCalc (第 77 行)
[q,errbnd] = vadapt(vfunAB,interval, …
出错 integral (第 87 行)
Q = integralCalc(fun,a,b,opstruct);
出错 MHBew_beamindex_hengxiangxiangganchagndu (第 36 行)
qtemp=qtemp+integral(fun,0,R); integral MATLAB Answers — New Questions
my for loop stop after the first valid number has been found how do i fix this
I am new to Matlab, just learned the for loop, basically the loop run properly, but stop after the first valid number has found.
numbers=importdata(‘numbers.txt’);
result_1=[];
for i =1:numel(numbers);
num=numbers(i);
if mod(num, 10) == 6 && mod(num, 4) == 0
answer_1=[result_1,num];
end
end
fprintf(‘The numbers that ends in 6 and are divisible by 4: n’);
fprintf(‘%dn’,answer_1)I am new to Matlab, just learned the for loop, basically the loop run properly, but stop after the first valid number has found.
numbers=importdata(‘numbers.txt’);
result_1=[];
for i =1:numel(numbers);
num=numbers(i);
if mod(num, 10) == 6 && mod(num, 4) == 0
answer_1=[result_1,num];
end
end
fprintf(‘The numbers that ends in 6 and are divisible by 4: n’);
fprintf(‘%dn’,answer_1) I am new to Matlab, just learned the for loop, basically the loop run properly, but stop after the first valid number has found.
numbers=importdata(‘numbers.txt’);
result_1=[];
for i =1:numel(numbers);
num=numbers(i);
if mod(num, 10) == 6 && mod(num, 4) == 0
answer_1=[result_1,num];
end
end
fprintf(‘The numbers that ends in 6 and are divisible by 4: n’);
fprintf(‘%dn’,answer_1) help for loop not working properly MATLAB Answers — New Questions
How to plot Mach Number Contours
Greetings everyone, below is the code which generates the diverging portion of a supersonic nozzle using the Method Of Characteristics. How can I plot the Mach Number contours within the same plot along with a colorbar? Thank you!
%% Initialize datapoint matrices
clear
G=1.4;
Me = 2;
n = 55;
display = 1;
Km = zeros(n,n); % K- vlaues (Constant along right running characteristic lines)
Kp = zeros(n,n); % K+ vlaues (Constant along left running characteristic lines)
Theta = zeros(n,n); % Flow angles relative to the horizontal
Mu = zeros(n,n); % Mach angles
M = zeros(n,n); % Mach Numbers
x = zeros(n,n); % x-coordinates
y = zeros(n,n); % y-coordinates
%% Generate the contraction region using a 3rd order polynomial. Do not run this
%{
R = 287;
T0 = 300;
% Define the mach number in contraction region
uu = 25.0; %velocity in contraction region
a = sqrt(G*R*T0 – 0.5*(G-1)*uu^2); % local speed of sound
Mconv = uu/a; % Mach number
% Calculate the area ratio of contraction region
[~,~,~,~,area] = flowisentropic(G,Mconv); % area ratio
% Inlet convergent section geometry
y0 =1;
H_in = area * y0;
L_e = 1.5; %(1.0/3.0)*xwall(end);
%
[xconv,yconv] = Convergent_3rd(G,y0,H_in,L_e,n);
%}
%% Generate the convergent portion of a nozzle
% The inlet height/area and exit height/area(divergent) are same
% Therefore we have same A/A* = 1.6875
% Corresponding to Mach = 0.3722
%% Find NuMax (maximum expansion angle)
[~, NuMax, ~] = PMF(G,Me,0,0);
ThetaMax = NuMax/2;
%% Define some flow parameters of originating characteristic lines
dT = ThetaMax/n;
ThetaArc(:,1) = (0:dT:ThetaMax);
NuArc = ThetaArc;
KmArc = ThetaArc + NuArc;
[~, ~, MuArc(:,1)] = PMF(G,0,NuArc(:,1),0);
%% Coordinates of wall along curve from throat
y0 = 1; % Define throat half-height
ThroatCurveRadius = 1.5*y0; % Radius of curvature just downstream of the throat
% for larger factors, ywall deviates from A/A* preferred value is 1.1
%L_e = 1.1 * y0 * sind(ThetaMax);
[xarc, yarc] = Arc(ThroatCurveRadius,ThetaArc); % Finds x- and y-coordinates for given theta-values
yarc(:,1) = yarc(:,1) + y0; % Defines offset due to arc being above horizontal
%% Fill in missing datapoint info along first C+ line
% First centerline datapoint done manually
Km(:,1) = KmArc(2:length(KmArc),1);
Theta(:,1) = ThetaArc(2:length(KmArc),1);
Nu(:,1) = Theta(:,1);
Kp(:,1) = Theta(:,1)-Nu(:,1);
M(1,1) = 1.0;
Nu(1,1) = 0;
Mu(1,1) = 90;
y(1,1) = 0;
x(1,1) = xarc(2,1) + (y(1,1) – yarc(2,1))/tand((ThetaArc(2,1) – MuArc(2,1) – MuArc(2,1))/2);
% Finds the information at interior nodes along first C+ line
for i=2:n
[M(i,1), Nu(i,1), Mu(i,1)] = PMF(G,0,Nu(i,1),0);
s1 = tand((ThetaArc(i+1,1) – MuArc(i+1,1) + Theta(i,1) – Mu(i,1))/2);
s2 = tand((Theta(i-1,1) + Mu(i-1,1) + Theta(i,1) + Mu(i,1))/2);
x(i,1) = ((y(i-1,1)-x(i-1,1)*s2)-(yarc(i+1,1)-xarc(i+1,1)*s1))/(s1-s2);
y(i,1) = y(i-1,1) + (x(i,1)-x(i-1,1))*s2;
end
%% Find flow properties at remaining interior nodes
for j=2:n;
for i=1:n+1-j;
Km(i,j) = Km(i+1,j-1);
if i==1;
Theta(i,j) = 0;
Kp(i,j) = -Km(i,j);
Nu(i,j) = Km(i,j);
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
x(i,j) = x(i+1,j-1) – y(i+1,j-1)/s1;
y(i,j) = 0;
else
Kp(i,j) = Kp(i-1,j);
Theta(i,j) = (Km(i,j)+Kp(i,j))/2;
Nu(i,j) = (Km(i,j)-Kp(i,j))/2;
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
s2 = tand((Theta(i-1,j)+Mu(i-1,j)+Theta(i,j)+Mu(i,j))/2);
x(i,j) = ((y(i-1,j)-x(i-1,j)*s2)-(y(i+1,j-1)-x(i+1,j-1)*s1))/(s1-s2);
y(i,j) = y(i-1,j) + (x(i,j)-x(i-1,j))*s2;
end
end
end
%% Find wall node information
xwall = zeros(2*n,1);
ywall = xwall;
ThetaWall = ywall;
xwall(1:n,1) = xarc(2:length(xarc),1);
ywall(1:n,1) = yarc(2:length(xarc),1);
ThetaWall(1:n,1) = ThetaArc(2:length(xarc),1);
for i=1:n-1
ThetaWall(n+i,1) = ThetaWall(n-i,1);
end
for i=1:n
s1 = tand((ThetaWall(n+i-1,1) + ThetaWall(n+i,1))/2);
s2 = tand(Theta(n+1-i,i)+Mu(n+1-i,i));
xwall(n+i,1) = ((y(n+1-i,i)-x(n+1-i,i)*s2)-(ywall(n+i-1,1)-xwall(n+i-1,1)*s1))/(s1-s2);
ywall(n+i,1) = ywall(n+i-1,1) + (xwall(n+i,1)-xwall(n+i-1,1))*s1;
end
%% Provide wall geometry to user
assignin(‘caller’,’xwall’,xwall)
assignin(‘caller’,’ywall’,ywall)
assignin(‘caller’,’Coords’,[xwall ywall])
%% Generate the convergent portion of nozzle % do not run this
H_in = ywall(end);
L_e = xwall(end)*(1.0/3.0);
[xconv,yconv] = Convergent_new_3rd(y0,H_in,L_e,n);
%%
% Draw contour and characteristic web
if display == 1
plot(xwall,ywall,’-‘)
axis equal
axis([0 ceil(xwall(length(xwall),1)) 0 ceil(ywall(length(ywall),1))])
hold on
plot(xarc,yarc,’k-‘)
for i=1:n-1
plot(x(1:n+1-i,i),y(1:n+1-i,i))
end
for i=1:n
plot([xarc(i,1) x(i,1)],[yarc(i,1) y(i,1)])
plot([x(n+1-i,i) xwall(i+n,1)],[y(n+1-i,i) ywall(i+n,1)])
end
for c=1:n
for r=2:n+1-c
plot([x(c,r) x(c+1,r-1)],[y(c,r) y(c+1,r-1)])
end
end
xlabel(‘Length [x/y0]’)
ylabel(‘Height [y/y0]’)
endGreetings everyone, below is the code which generates the diverging portion of a supersonic nozzle using the Method Of Characteristics. How can I plot the Mach Number contours within the same plot along with a colorbar? Thank you!
%% Initialize datapoint matrices
clear
G=1.4;
Me = 2;
n = 55;
display = 1;
Km = zeros(n,n); % K- vlaues (Constant along right running characteristic lines)
Kp = zeros(n,n); % K+ vlaues (Constant along left running characteristic lines)
Theta = zeros(n,n); % Flow angles relative to the horizontal
Mu = zeros(n,n); % Mach angles
M = zeros(n,n); % Mach Numbers
x = zeros(n,n); % x-coordinates
y = zeros(n,n); % y-coordinates
%% Generate the contraction region using a 3rd order polynomial. Do not run this
%{
R = 287;
T0 = 300;
% Define the mach number in contraction region
uu = 25.0; %velocity in contraction region
a = sqrt(G*R*T0 – 0.5*(G-1)*uu^2); % local speed of sound
Mconv = uu/a; % Mach number
% Calculate the area ratio of contraction region
[~,~,~,~,area] = flowisentropic(G,Mconv); % area ratio
% Inlet convergent section geometry
y0 =1;
H_in = area * y0;
L_e = 1.5; %(1.0/3.0)*xwall(end);
%
[xconv,yconv] = Convergent_3rd(G,y0,H_in,L_e,n);
%}
%% Generate the convergent portion of a nozzle
% The inlet height/area and exit height/area(divergent) are same
% Therefore we have same A/A* = 1.6875
% Corresponding to Mach = 0.3722
%% Find NuMax (maximum expansion angle)
[~, NuMax, ~] = PMF(G,Me,0,0);
ThetaMax = NuMax/2;
%% Define some flow parameters of originating characteristic lines
dT = ThetaMax/n;
ThetaArc(:,1) = (0:dT:ThetaMax);
NuArc = ThetaArc;
KmArc = ThetaArc + NuArc;
[~, ~, MuArc(:,1)] = PMF(G,0,NuArc(:,1),0);
%% Coordinates of wall along curve from throat
y0 = 1; % Define throat half-height
ThroatCurveRadius = 1.5*y0; % Radius of curvature just downstream of the throat
% for larger factors, ywall deviates from A/A* preferred value is 1.1
%L_e = 1.1 * y0 * sind(ThetaMax);
[xarc, yarc] = Arc(ThroatCurveRadius,ThetaArc); % Finds x- and y-coordinates for given theta-values
yarc(:,1) = yarc(:,1) + y0; % Defines offset due to arc being above horizontal
%% Fill in missing datapoint info along first C+ line
% First centerline datapoint done manually
Km(:,1) = KmArc(2:length(KmArc),1);
Theta(:,1) = ThetaArc(2:length(KmArc),1);
Nu(:,1) = Theta(:,1);
Kp(:,1) = Theta(:,1)-Nu(:,1);
M(1,1) = 1.0;
Nu(1,1) = 0;
Mu(1,1) = 90;
y(1,1) = 0;
x(1,1) = xarc(2,1) + (y(1,1) – yarc(2,1))/tand((ThetaArc(2,1) – MuArc(2,1) – MuArc(2,1))/2);
% Finds the information at interior nodes along first C+ line
for i=2:n
[M(i,1), Nu(i,1), Mu(i,1)] = PMF(G,0,Nu(i,1),0);
s1 = tand((ThetaArc(i+1,1) – MuArc(i+1,1) + Theta(i,1) – Mu(i,1))/2);
s2 = tand((Theta(i-1,1) + Mu(i-1,1) + Theta(i,1) + Mu(i,1))/2);
x(i,1) = ((y(i-1,1)-x(i-1,1)*s2)-(yarc(i+1,1)-xarc(i+1,1)*s1))/(s1-s2);
y(i,1) = y(i-1,1) + (x(i,1)-x(i-1,1))*s2;
end
%% Find flow properties at remaining interior nodes
for j=2:n;
for i=1:n+1-j;
Km(i,j) = Km(i+1,j-1);
if i==1;
Theta(i,j) = 0;
Kp(i,j) = -Km(i,j);
Nu(i,j) = Km(i,j);
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
x(i,j) = x(i+1,j-1) – y(i+1,j-1)/s1;
y(i,j) = 0;
else
Kp(i,j) = Kp(i-1,j);
Theta(i,j) = (Km(i,j)+Kp(i,j))/2;
Nu(i,j) = (Km(i,j)-Kp(i,j))/2;
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
s2 = tand((Theta(i-1,j)+Mu(i-1,j)+Theta(i,j)+Mu(i,j))/2);
x(i,j) = ((y(i-1,j)-x(i-1,j)*s2)-(y(i+1,j-1)-x(i+1,j-1)*s1))/(s1-s2);
y(i,j) = y(i-1,j) + (x(i,j)-x(i-1,j))*s2;
end
end
end
%% Find wall node information
xwall = zeros(2*n,1);
ywall = xwall;
ThetaWall = ywall;
xwall(1:n,1) = xarc(2:length(xarc),1);
ywall(1:n,1) = yarc(2:length(xarc),1);
ThetaWall(1:n,1) = ThetaArc(2:length(xarc),1);
for i=1:n-1
ThetaWall(n+i,1) = ThetaWall(n-i,1);
end
for i=1:n
s1 = tand((ThetaWall(n+i-1,1) + ThetaWall(n+i,1))/2);
s2 = tand(Theta(n+1-i,i)+Mu(n+1-i,i));
xwall(n+i,1) = ((y(n+1-i,i)-x(n+1-i,i)*s2)-(ywall(n+i-1,1)-xwall(n+i-1,1)*s1))/(s1-s2);
ywall(n+i,1) = ywall(n+i-1,1) + (xwall(n+i,1)-xwall(n+i-1,1))*s1;
end
%% Provide wall geometry to user
assignin(‘caller’,’xwall’,xwall)
assignin(‘caller’,’ywall’,ywall)
assignin(‘caller’,’Coords’,[xwall ywall])
%% Generate the convergent portion of nozzle % do not run this
H_in = ywall(end);
L_e = xwall(end)*(1.0/3.0);
[xconv,yconv] = Convergent_new_3rd(y0,H_in,L_e,n);
%%
% Draw contour and characteristic web
if display == 1
plot(xwall,ywall,’-‘)
axis equal
axis([0 ceil(xwall(length(xwall),1)) 0 ceil(ywall(length(ywall),1))])
hold on
plot(xarc,yarc,’k-‘)
for i=1:n-1
plot(x(1:n+1-i,i),y(1:n+1-i,i))
end
for i=1:n
plot([xarc(i,1) x(i,1)],[yarc(i,1) y(i,1)])
plot([x(n+1-i,i) xwall(i+n,1)],[y(n+1-i,i) ywall(i+n,1)])
end
for c=1:n
for r=2:n+1-c
plot([x(c,r) x(c+1,r-1)],[y(c,r) y(c+1,r-1)])
end
end
xlabel(‘Length [x/y0]’)
ylabel(‘Height [y/y0]’)
end Greetings everyone, below is the code which generates the diverging portion of a supersonic nozzle using the Method Of Characteristics. How can I plot the Mach Number contours within the same plot along with a colorbar? Thank you!
%% Initialize datapoint matrices
clear
G=1.4;
Me = 2;
n = 55;
display = 1;
Km = zeros(n,n); % K- vlaues (Constant along right running characteristic lines)
Kp = zeros(n,n); % K+ vlaues (Constant along left running characteristic lines)
Theta = zeros(n,n); % Flow angles relative to the horizontal
Mu = zeros(n,n); % Mach angles
M = zeros(n,n); % Mach Numbers
x = zeros(n,n); % x-coordinates
y = zeros(n,n); % y-coordinates
%% Generate the contraction region using a 3rd order polynomial. Do not run this
%{
R = 287;
T0 = 300;
% Define the mach number in contraction region
uu = 25.0; %velocity in contraction region
a = sqrt(G*R*T0 – 0.5*(G-1)*uu^2); % local speed of sound
Mconv = uu/a; % Mach number
% Calculate the area ratio of contraction region
[~,~,~,~,area] = flowisentropic(G,Mconv); % area ratio
% Inlet convergent section geometry
y0 =1;
H_in = area * y0;
L_e = 1.5; %(1.0/3.0)*xwall(end);
%
[xconv,yconv] = Convergent_3rd(G,y0,H_in,L_e,n);
%}
%% Generate the convergent portion of a nozzle
% The inlet height/area and exit height/area(divergent) are same
% Therefore we have same A/A* = 1.6875
% Corresponding to Mach = 0.3722
%% Find NuMax (maximum expansion angle)
[~, NuMax, ~] = PMF(G,Me,0,0);
ThetaMax = NuMax/2;
%% Define some flow parameters of originating characteristic lines
dT = ThetaMax/n;
ThetaArc(:,1) = (0:dT:ThetaMax);
NuArc = ThetaArc;
KmArc = ThetaArc + NuArc;
[~, ~, MuArc(:,1)] = PMF(G,0,NuArc(:,1),0);
%% Coordinates of wall along curve from throat
y0 = 1; % Define throat half-height
ThroatCurveRadius = 1.5*y0; % Radius of curvature just downstream of the throat
% for larger factors, ywall deviates from A/A* preferred value is 1.1
%L_e = 1.1 * y0 * sind(ThetaMax);
[xarc, yarc] = Arc(ThroatCurveRadius,ThetaArc); % Finds x- and y-coordinates for given theta-values
yarc(:,1) = yarc(:,1) + y0; % Defines offset due to arc being above horizontal
%% Fill in missing datapoint info along first C+ line
% First centerline datapoint done manually
Km(:,1) = KmArc(2:length(KmArc),1);
Theta(:,1) = ThetaArc(2:length(KmArc),1);
Nu(:,1) = Theta(:,1);
Kp(:,1) = Theta(:,1)-Nu(:,1);
M(1,1) = 1.0;
Nu(1,1) = 0;
Mu(1,1) = 90;
y(1,1) = 0;
x(1,1) = xarc(2,1) + (y(1,1) – yarc(2,1))/tand((ThetaArc(2,1) – MuArc(2,1) – MuArc(2,1))/2);
% Finds the information at interior nodes along first C+ line
for i=2:n
[M(i,1), Nu(i,1), Mu(i,1)] = PMF(G,0,Nu(i,1),0);
s1 = tand((ThetaArc(i+1,1) – MuArc(i+1,1) + Theta(i,1) – Mu(i,1))/2);
s2 = tand((Theta(i-1,1) + Mu(i-1,1) + Theta(i,1) + Mu(i,1))/2);
x(i,1) = ((y(i-1,1)-x(i-1,1)*s2)-(yarc(i+1,1)-xarc(i+1,1)*s1))/(s1-s2);
y(i,1) = y(i-1,1) + (x(i,1)-x(i-1,1))*s2;
end
%% Find flow properties at remaining interior nodes
for j=2:n;
for i=1:n+1-j;
Km(i,j) = Km(i+1,j-1);
if i==1;
Theta(i,j) = 0;
Kp(i,j) = -Km(i,j);
Nu(i,j) = Km(i,j);
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
x(i,j) = x(i+1,j-1) – y(i+1,j-1)/s1;
y(i,j) = 0;
else
Kp(i,j) = Kp(i-1,j);
Theta(i,j) = (Km(i,j)+Kp(i,j))/2;
Nu(i,j) = (Km(i,j)-Kp(i,j))/2;
[M(i,j), Nu(i,j), Mu(i,j)] = PMF(G,0,Nu(i,j),0);
s1 = tand((Theta(i+1,j-1)-Mu(i+1,j-1)+Theta(i,j)-Mu(i,j))/2);
s2 = tand((Theta(i-1,j)+Mu(i-1,j)+Theta(i,j)+Mu(i,j))/2);
x(i,j) = ((y(i-1,j)-x(i-1,j)*s2)-(y(i+1,j-1)-x(i+1,j-1)*s1))/(s1-s2);
y(i,j) = y(i-1,j) + (x(i,j)-x(i-1,j))*s2;
end
end
end
%% Find wall node information
xwall = zeros(2*n,1);
ywall = xwall;
ThetaWall = ywall;
xwall(1:n,1) = xarc(2:length(xarc),1);
ywall(1:n,1) = yarc(2:length(xarc),1);
ThetaWall(1:n,1) = ThetaArc(2:length(xarc),1);
for i=1:n-1
ThetaWall(n+i,1) = ThetaWall(n-i,1);
end
for i=1:n
s1 = tand((ThetaWall(n+i-1,1) + ThetaWall(n+i,1))/2);
s2 = tand(Theta(n+1-i,i)+Mu(n+1-i,i));
xwall(n+i,1) = ((y(n+1-i,i)-x(n+1-i,i)*s2)-(ywall(n+i-1,1)-xwall(n+i-1,1)*s1))/(s1-s2);
ywall(n+i,1) = ywall(n+i-1,1) + (xwall(n+i,1)-xwall(n+i-1,1))*s1;
end
%% Provide wall geometry to user
assignin(‘caller’,’xwall’,xwall)
assignin(‘caller’,’ywall’,ywall)
assignin(‘caller’,’Coords’,[xwall ywall])
%% Generate the convergent portion of nozzle % do not run this
H_in = ywall(end);
L_e = xwall(end)*(1.0/3.0);
[xconv,yconv] = Convergent_new_3rd(y0,H_in,L_e,n);
%%
% Draw contour and characteristic web
if display == 1
plot(xwall,ywall,’-‘)
axis equal
axis([0 ceil(xwall(length(xwall),1)) 0 ceil(ywall(length(ywall),1))])
hold on
plot(xarc,yarc,’k-‘)
for i=1:n-1
plot(x(1:n+1-i,i),y(1:n+1-i,i))
end
for i=1:n
plot([xarc(i,1) x(i,1)],[yarc(i,1) y(i,1)])
plot([x(n+1-i,i) xwall(i+n,1)],[y(n+1-i,i) ywall(i+n,1)])
end
for c=1:n
for r=2:n+1-c
plot([x(c,r) x(c+1,r-1)],[y(c,r) y(c+1,r-1)])
end
end
xlabel(‘Length [x/y0]’)
ylabel(‘Height [y/y0]’)
end #contour plot, nozzle, mach number MATLAB Answers — New Questions
How do you track a tip of a pendulium and plot its displacement against time?
I’m trying to track the horizontal motion of a tip of an oscillating pendulum and plot it’s displacement versus time graph. This y-axis is fixed through the frames.
I know i have to : 1) upload the video 2) read each frame 3) track a point on each frame 4) plot the displacement of that tip vs time
video: https://www.dropbox.com/scl/fi/9kauaf0lxm8i69ru04xsl/FR.mp4?rlkey=mzrt6ffxjli7c30e90ir0bcv6&st=sxodfpxh&dl=0
And so far, i’ve used this:
close all;clear all;
% read video file; xyobj is an matlab object
%there are files:
filename=’FR1-10-2.mp4′;
xyobj = VideoReader(filename);
% number available frames
nframes = xyobj.NumberOfFrames-1
% frame rate
framerate=xyobj.FrameRate
vidHeight = xyobj.Height
vidWidth = xyobj.Width
frame(1) = struct(‘cdata’, zeros(vidHeight, vidWidth, 3, ‘uint8′),’colormap’,[]);
figure(1)
% Specify the boundary of the region to cut
b3=220;b4=350;
b1=375;b2=640;
xmax=b4-b3;
ymax=b2-b1;
hold on
grid on
xlabel(‘x’)
ylabel(‘y’)
axis([ 1 xmax 1 ymax]);
kk=0;
for k1 = 1:nframes-1,
k=nframes-k1;
k
frame(1).cdata=read(xyobj,k);
oneframe=frame(1).cdata;
oneframecut=oneframe(b1:b2,b3:b4,:); % cut an area with ball only to help for recognition
for jp=1:206,
jp1=jp+50-1;
greenChannel = oneframecut(jp1,:, 2);
[xm,im]=min(greenChannel);
xedge(k,jp)=im;
pedge(k,jp)=xm;
end
%pause(0.1)
end
save FR.pos xedge -ascii
pedge1=cast(pedge,"double");
save FR.val pedge1 -ascii
Your help is really appreciated!I’m trying to track the horizontal motion of a tip of an oscillating pendulum and plot it’s displacement versus time graph. This y-axis is fixed through the frames.
I know i have to : 1) upload the video 2) read each frame 3) track a point on each frame 4) plot the displacement of that tip vs time
video: https://www.dropbox.com/scl/fi/9kauaf0lxm8i69ru04xsl/FR.mp4?rlkey=mzrt6ffxjli7c30e90ir0bcv6&st=sxodfpxh&dl=0
And so far, i’ve used this:
close all;clear all;
% read video file; xyobj is an matlab object
%there are files:
filename=’FR1-10-2.mp4′;
xyobj = VideoReader(filename);
% number available frames
nframes = xyobj.NumberOfFrames-1
% frame rate
framerate=xyobj.FrameRate
vidHeight = xyobj.Height
vidWidth = xyobj.Width
frame(1) = struct(‘cdata’, zeros(vidHeight, vidWidth, 3, ‘uint8′),’colormap’,[]);
figure(1)
% Specify the boundary of the region to cut
b3=220;b4=350;
b1=375;b2=640;
xmax=b4-b3;
ymax=b2-b1;
hold on
grid on
xlabel(‘x’)
ylabel(‘y’)
axis([ 1 xmax 1 ymax]);
kk=0;
for k1 = 1:nframes-1,
k=nframes-k1;
k
frame(1).cdata=read(xyobj,k);
oneframe=frame(1).cdata;
oneframecut=oneframe(b1:b2,b3:b4,:); % cut an area with ball only to help for recognition
for jp=1:206,
jp1=jp+50-1;
greenChannel = oneframecut(jp1,:, 2);
[xm,im]=min(greenChannel);
xedge(k,jp)=im;
pedge(k,jp)=xm;
end
%pause(0.1)
end
save FR.pos xedge -ascii
pedge1=cast(pedge,"double");
save FR.val pedge1 -ascii
Your help is really appreciated! I’m trying to track the horizontal motion of a tip of an oscillating pendulum and plot it’s displacement versus time graph. This y-axis is fixed through the frames.
I know i have to : 1) upload the video 2) read each frame 3) track a point on each frame 4) plot the displacement of that tip vs time
video: https://www.dropbox.com/scl/fi/9kauaf0lxm8i69ru04xsl/FR.mp4?rlkey=mzrt6ffxjli7c30e90ir0bcv6&st=sxodfpxh&dl=0
And so far, i’ve used this:
close all;clear all;
% read video file; xyobj is an matlab object
%there are files:
filename=’FR1-10-2.mp4′;
xyobj = VideoReader(filename);
% number available frames
nframes = xyobj.NumberOfFrames-1
% frame rate
framerate=xyobj.FrameRate
vidHeight = xyobj.Height
vidWidth = xyobj.Width
frame(1) = struct(‘cdata’, zeros(vidHeight, vidWidth, 3, ‘uint8′),’colormap’,[]);
figure(1)
% Specify the boundary of the region to cut
b3=220;b4=350;
b1=375;b2=640;
xmax=b4-b3;
ymax=b2-b1;
hold on
grid on
xlabel(‘x’)
ylabel(‘y’)
axis([ 1 xmax 1 ymax]);
kk=0;
for k1 = 1:nframes-1,
k=nframes-k1;
k
frame(1).cdata=read(xyobj,k);
oneframe=frame(1).cdata;
oneframecut=oneframe(b1:b2,b3:b4,:); % cut an area with ball only to help for recognition
for jp=1:206,
jp1=jp+50-1;
greenChannel = oneframecut(jp1,:, 2);
[xm,im]=min(greenChannel);
xedge(k,jp)=im;
pedge(k,jp)=xm;
end
%pause(0.1)
end
save FR.pos xedge -ascii
pedge1=cast(pedge,"double");
save FR.val pedge1 -ascii
Your help is really appreciated! image processing MATLAB Answers — New Questions
AI to help with Matlab scripting and Simulink Drawing
Is there an AI for matlab scripts and simulink drawings? (I am not asking how to BUILD an AI system.I am asking for help with scripting and simulink via a Mathworks ai site)Is there an AI for matlab scripts and simulink drawings? (I am not asking how to BUILD an AI system.I am asking for help with scripting and simulink via a Mathworks ai site) Is there an AI for matlab scripts and simulink drawings? (I am not asking how to BUILD an AI system.I am asking for help with scripting and simulink via a Mathworks ai site) ai, scripting, simulink, help, make easy, website, free MATLAB Answers — New Questions
How to Extract Delayed State Terms in a Model with Distributed Delay?
I’m working on a model with distributed delays, and I’m using the ddesd function to solve the delay differential equations. My setup involves a distributed delay, defined by:
tau = 1;
gamma = 0.5;
number_of_delays = 11; % should be odd
lags = linspace(tau-gamma,tau+gamma,number_of_delays);
tspan=[0 600];
sol=ddesd(@(t,y,Z)ddefunc(t,y,Z,lags),lags,[0.2; 0.08],tspan);
p=plot(sol.x,sol.y);
set(p,{‘LineWidth’},{2;2})
title(‘y(t)’)
xlabel(‘Time(days)’), ylabel(‘populations’)
legend(‘x’,’y’)
function yp = ddefunc(~,y,Z,lags)
a=0.1;
b=0.05;
c=0.08;
d=0.02;
yl1 = trapz(lags,Z(2,:));
yp = [a*y(1)-b*y(1)*yl1;
c*y(1)*y(2)-d*y(2)];
end
In the case of discrete delays, we can easily extract the delayed state terms using the deval or interp1 commands. However, I’m unsure how to proceed with extracting or examining the delayed state terms for distributed delay case.I’m working on a model with distributed delays, and I’m using the ddesd function to solve the delay differential equations. My setup involves a distributed delay, defined by:
tau = 1;
gamma = 0.5;
number_of_delays = 11; % should be odd
lags = linspace(tau-gamma,tau+gamma,number_of_delays);
tspan=[0 600];
sol=ddesd(@(t,y,Z)ddefunc(t,y,Z,lags),lags,[0.2; 0.08],tspan);
p=plot(sol.x,sol.y);
set(p,{‘LineWidth’},{2;2})
title(‘y(t)’)
xlabel(‘Time(days)’), ylabel(‘populations’)
legend(‘x’,’y’)
function yp = ddefunc(~,y,Z,lags)
a=0.1;
b=0.05;
c=0.08;
d=0.02;
yl1 = trapz(lags,Z(2,:));
yp = [a*y(1)-b*y(1)*yl1;
c*y(1)*y(2)-d*y(2)];
end
In the case of discrete delays, we can easily extract the delayed state terms using the deval or interp1 commands. However, I’m unsure how to proceed with extracting or examining the delayed state terms for distributed delay case. I’m working on a model with distributed delays, and I’m using the ddesd function to solve the delay differential equations. My setup involves a distributed delay, defined by:
tau = 1;
gamma = 0.5;
number_of_delays = 11; % should be odd
lags = linspace(tau-gamma,tau+gamma,number_of_delays);
tspan=[0 600];
sol=ddesd(@(t,y,Z)ddefunc(t,y,Z,lags),lags,[0.2; 0.08],tspan);
p=plot(sol.x,sol.y);
set(p,{‘LineWidth’},{2;2})
title(‘y(t)’)
xlabel(‘Time(days)’), ylabel(‘populations’)
legend(‘x’,’y’)
function yp = ddefunc(~,y,Z,lags)
a=0.1;
b=0.05;
c=0.08;
d=0.02;
yl1 = trapz(lags,Z(2,:));
yp = [a*y(1)-b*y(1)*yl1;
c*y(1)*y(2)-d*y(2)];
end
In the case of discrete delays, we can easily extract the delayed state terms using the deval or interp1 commands. However, I’m unsure how to proceed with extracting or examining the delayed state terms for distributed delay case. distributed delay, ddesd, delay differential equation, delayed state MATLAB Answers — New Questions
Simulink model for Turtlebot movement along a trajectory avoiding objects
I am working on creating a model in Simulink that allows me to control a Turtlebot waffle pi so that it moves along a 6-point path. Along the path there will be obstacles in the form of red and green spheres. The objective is for the robot to reach all the points of the path avoiding the obstacles, if the sphere is red, avoid to the right and if it is green, avoid to the left.
I have already created the following Simulink model where the most important thing is in the control function since it describes the behavior of the robot, however the error that keeps appearing is the following: Error: Block ”Project_3/MATLAB Function” does not fully set the dimensions of output ‘next_index’. Which I do not find sense since the variable next_index is defined from the beginning. I attach the images of the model that I am creating.
function [area, x_obst, y_obst, target_x, target_y, obstacle, current_index, target_theta,last_point] = WaypointSelector(a, cent, waypoints, current_index)
%Extract obstacle’s area and position
[~,i] = max(a);
area = max(a);
if ~isempty(i)
obstacle = cent(i,:);
else
obstacle = [0,0];
end
% Cordanates of the obstacles
x_obst = obstacle(1);
y_obst = obstacle(2);
% Extract target waypoint
target_x = waypoints(current_index, 1);
target_y = waypoints(current_index, 2);
last_point = size(waypoints, 1);
target_theta = waypoints(current_index, 3);
target_theta = atan2(sin(target_theta), cos(target_theta));
end
CONTROL FUNCTION:
function [v, omega, next_index] = ComputeControl(target_x, target_y, obstacle, current_index, target_theta, last_point, current_x, current_y, x_ang, y_ang, z_ang, w_ang, ranges)
% Constants
max_velocity = 0.2; % max linear velocity
max_yaw_rate = 0.4; % max angular velocity
max_distance = 0.05; % max distance to consider waypoint reached
l = 640; % size of the camera’s image
h = 480;
% Initialize output
next_index = int32(current_index); % Initialize as integer (or the appropriate type)
% Coordinates of the obstacles
x_obst = obstacle(1);
y_obst = obstacle(2);
% Position and direction of the robot
current_angle = quat2eul([x_ang y_ang z_ang w_ang]);
yaw_angle = current_angle(3);
if yaw_angle > pi
current_theta = yaw_angle – 2*pi;
else
current_theta = yaw_angle;
end
% Compute distance and angle to the target waypoint
dx = target_x – current_x;
dy = target_y – current_y;
distance = sqrt(dx^2 + dy^2); % Distance to the waypoints
dist_obs = min(ranges); % Distance to the closest obstacle (Radar)
angle_to_target = atan2(dy, dx); % Angle needed to reach the waypoints
% Adjust the angle to be in the range [-pi, pi]
if dx < 0
if dy > 0
angle_to_target = angle_to_target + pi;
else
angle_to_target = angle_to_target – pi;
end
end
% Compute delta theta and the error in the direction
d_theta = target_theta – current_theta;
angle_error = current_theta – angle_to_target;
% Compute the control logic commands to achieve the waypoints and avoid the obstacles
if (x_obst – l/2) > 0
omega = max_yaw_rate;
v = max_velocity;
else
if current_index > last_point
v = 0;
omega = 0;
next_index = current_index;
else
if distance <= max_distance && abs(d_theta) <= 0.05
next_index = current_index + 1;
else
next_index = current_index; % Ensure next_index is assigned
end
if distance > max_distance
if abs(angle_error) > 0.01
if abs(angle_error) > 0.5
omega = max_yaw_rate;
elseif abs(angle_error) > 0.3 && abs(angle_error) <= 0.5
omega = 0.5 * max_yaw_rate;
else
omega = 0.1 * max_yaw_rate;
end
if current_theta > angle_to_target && current_index < 7
omega = -omega;
end
if distance >= 3 * max_distance
v = max_velocity;
else
v = max_velocity * (distance / (distance + 1));
end
else
omega = 0;
if distance >= 3 * max_distance
v = max_velocity;
else
v = max_velocity * (distance / (distance + 1));
end
end
else
if abs(d_theta) > 0.05
omega = max_yaw_rate * d_theta;
v = 0;
if current_theta > target_theta
omega = -omega;
end
else
omega = 0;
v = 0;
end
end
end
end
% Limit the velocities just in case
v = min(v, max_velocity);
omega = min(max(omega, -max_yaw_rate), max_yaw_rate);
endI am working on creating a model in Simulink that allows me to control a Turtlebot waffle pi so that it moves along a 6-point path. Along the path there will be obstacles in the form of red and green spheres. The objective is for the robot to reach all the points of the path avoiding the obstacles, if the sphere is red, avoid to the right and if it is green, avoid to the left.
I have already created the following Simulink model where the most important thing is in the control function since it describes the behavior of the robot, however the error that keeps appearing is the following: Error: Block ”Project_3/MATLAB Function” does not fully set the dimensions of output ‘next_index’. Which I do not find sense since the variable next_index is defined from the beginning. I attach the images of the model that I am creating.
function [area, x_obst, y_obst, target_x, target_y, obstacle, current_index, target_theta,last_point] = WaypointSelector(a, cent, waypoints, current_index)
%Extract obstacle’s area and position
[~,i] = max(a);
area = max(a);
if ~isempty(i)
obstacle = cent(i,:);
else
obstacle = [0,0];
end
% Cordanates of the obstacles
x_obst = obstacle(1);
y_obst = obstacle(2);
% Extract target waypoint
target_x = waypoints(current_index, 1);
target_y = waypoints(current_index, 2);
last_point = size(waypoints, 1);
target_theta = waypoints(current_index, 3);
target_theta = atan2(sin(target_theta), cos(target_theta));
end
CONTROL FUNCTION:
function [v, omega, next_index] = ComputeControl(target_x, target_y, obstacle, current_index, target_theta, last_point, current_x, current_y, x_ang, y_ang, z_ang, w_ang, ranges)
% Constants
max_velocity = 0.2; % max linear velocity
max_yaw_rate = 0.4; % max angular velocity
max_distance = 0.05; % max distance to consider waypoint reached
l = 640; % size of the camera’s image
h = 480;
% Initialize output
next_index = int32(current_index); % Initialize as integer (or the appropriate type)
% Coordinates of the obstacles
x_obst = obstacle(1);
y_obst = obstacle(2);
% Position and direction of the robot
current_angle = quat2eul([x_ang y_ang z_ang w_ang]);
yaw_angle = current_angle(3);
if yaw_angle > pi
current_theta = yaw_angle – 2*pi;
else
current_theta = yaw_angle;
end
% Compute distance and angle to the target waypoint
dx = target_x – current_x;
dy = target_y – current_y;
distance = sqrt(dx^2 + dy^2); % Distance to the waypoints
dist_obs = min(ranges); % Distance to the closest obstacle (Radar)
angle_to_target = atan2(dy, dx); % Angle needed to reach the waypoints
% Adjust the angle to be in the range [-pi, pi]
if dx < 0
if dy > 0
angle_to_target = angle_to_target + pi;
else
angle_to_target = angle_to_target – pi;
end
end
% Compute delta theta and the error in the direction
d_theta = target_theta – current_theta;
angle_error = current_theta – angle_to_target;
% Compute the control logic commands to achieve the waypoints and avoid the obstacles
if (x_obst – l/2) > 0
omega = max_yaw_rate;
v = max_velocity;
else
if current_index > last_point
v = 0;
omega = 0;
next_index = current_index;
else
if distance <= max_distance && abs(d_theta) <= 0.05
next_index = current_index + 1;
else
next_index = current_index; % Ensure next_index is assigned
end
if distance > max_distance
if abs(angle_error) > 0.01
if abs(angle_error) > 0.5
omega = max_yaw_rate;
elseif abs(angle_error) > 0.3 && abs(angle_error) <= 0.5
omega = 0.5 * max_yaw_rate;
else
omega = 0.1 * max_yaw_rate;
end
if current_theta > angle_to_target && current_index < 7
omega = -omega;
end
if distance >= 3 * max_distance
v = max_velocity;
else
v = max_velocity * (distance / (distance + 1));
end
else
omega = 0;
if distance >= 3 * max_distance
v = max_velocity;
else
v = max_velocity * (distance / (distance + 1));
end
end
else
if abs(d_theta) > 0.05
omega = max_yaw_rate * d_theta;
v = 0;
if current_theta > target_theta
omega = -omega;
end
else
omega = 0;
v = 0;
end
end
end
end
% Limit the velocities just in case
v = min(v, max_velocity);
omega = min(max(omega, -max_yaw_rate), max_yaw_rate);
end I am working on creating a model in Simulink that allows me to control a Turtlebot waffle pi so that it moves along a 6-point path. Along the path there will be obstacles in the form of red and green spheres. The objective is for the robot to reach all the points of the path avoiding the obstacles, if the sphere is red, avoid to the right and if it is green, avoid to the left.
I have already created the following Simulink model where the most important thing is in the control function since it describes the behavior of the robot, however the error that keeps appearing is the following: Error: Block ”Project_3/MATLAB Function” does not fully set the dimensions of output ‘next_index’. Which I do not find sense since the variable next_index is defined from the beginning. I attach the images of the model that I am creating.
function [area, x_obst, y_obst, target_x, target_y, obstacle, current_index, target_theta,last_point] = WaypointSelector(a, cent, waypoints, current_index)
%Extract obstacle’s area and position
[~,i] = max(a);
area = max(a);
if ~isempty(i)
obstacle = cent(i,:);
else
obstacle = [0,0];
end
% Cordanates of the obstacles
x_obst = obstacle(1);
y_obst = obstacle(2);
% Extract target waypoint
target_x = waypoints(current_index, 1);
target_y = waypoints(current_index, 2);
last_point = size(waypoints, 1);
target_theta = waypoints(current_index, 3);
target_theta = atan2(sin(target_theta), cos(target_theta));
end
CONTROL FUNCTION:
function [v, omega, next_index] = ComputeControl(target_x, target_y, obstacle, current_index, target_theta, last_point, current_x, current_y, x_ang, y_ang, z_ang, w_ang, ranges)
% Constants
max_velocity = 0.2; % max linear velocity
max_yaw_rate = 0.4; % max angular velocity
max_distance = 0.05; % max distance to consider waypoint reached
l = 640; % size of the camera’s image
h = 480;
% Initialize output
next_index = int32(current_index); % Initialize as integer (or the appropriate type)
% Coordinates of the obstacles
x_obst = obstacle(1);
y_obst = obstacle(2);
% Position and direction of the robot
current_angle = quat2eul([x_ang y_ang z_ang w_ang]);
yaw_angle = current_angle(3);
if yaw_angle > pi
current_theta = yaw_angle – 2*pi;
else
current_theta = yaw_angle;
end
% Compute distance and angle to the target waypoint
dx = target_x – current_x;
dy = target_y – current_y;
distance = sqrt(dx^2 + dy^2); % Distance to the waypoints
dist_obs = min(ranges); % Distance to the closest obstacle (Radar)
angle_to_target = atan2(dy, dx); % Angle needed to reach the waypoints
% Adjust the angle to be in the range [-pi, pi]
if dx < 0
if dy > 0
angle_to_target = angle_to_target + pi;
else
angle_to_target = angle_to_target – pi;
end
end
% Compute delta theta and the error in the direction
d_theta = target_theta – current_theta;
angle_error = current_theta – angle_to_target;
% Compute the control logic commands to achieve the waypoints and avoid the obstacles
if (x_obst – l/2) > 0
omega = max_yaw_rate;
v = max_velocity;
else
if current_index > last_point
v = 0;
omega = 0;
next_index = current_index;
else
if distance <= max_distance && abs(d_theta) <= 0.05
next_index = current_index + 1;
else
next_index = current_index; % Ensure next_index is assigned
end
if distance > max_distance
if abs(angle_error) > 0.01
if abs(angle_error) > 0.5
omega = max_yaw_rate;
elseif abs(angle_error) > 0.3 && abs(angle_error) <= 0.5
omega = 0.5 * max_yaw_rate;
else
omega = 0.1 * max_yaw_rate;
end
if current_theta > angle_to_target && current_index < 7
omega = -omega;
end
if distance >= 3 * max_distance
v = max_velocity;
else
v = max_velocity * (distance / (distance + 1));
end
else
omega = 0;
if distance >= 3 * max_distance
v = max_velocity;
else
v = max_velocity * (distance / (distance + 1));
end
end
else
if abs(d_theta) > 0.05
omega = max_yaw_rate * d_theta;
v = 0;
if current_theta > target_theta
omega = -omega;
end
else
omega = 0;
v = 0;
end
end
end
end
% Limit the velocities just in case
v = min(v, max_velocity);
omega = min(max(omega, -max_yaw_rate), max_yaw_rate);
end simulink, turtlebot, matlab, control, gazebo, ros, image processing, motion, error MATLAB Answers — New Questions
How “medfilt1(X,N) filter logic works. How to convert this into embedded c language. please suggest how to do this.
Hello sir,
we preferred to use the median filter "medfilt1(X,N) to filter the noise and spikes in the data. please give the logic how this filter works, how we can convert the matlab code to embedded c format.
thanks & regardsHello sir,
we preferred to use the median filter "medfilt1(X,N) to filter the noise and spikes in the data. please give the logic how this filter works, how we can convert the matlab code to embedded c format.
thanks & regards Hello sir,
we preferred to use the median filter "medfilt1(X,N) to filter the noise and spikes in the data. please give the logic how this filter works, how we can convert the matlab code to embedded c format.
thanks & regards signal processing MATLAB Answers — New Questions
how to make an identifer for string variables
Hi
I have a list of string variables, which all ends with "_STI". How can I group them together so that I can perform the same operations to them. For example, I want to assign a number to all the variables ends with "_STI".
Thanks very muchHi
I have a list of string variables, which all ends with "_STI". How can I group them together so that I can perform the same operations to them. For example, I want to assign a number to all the variables ends with "_STI".
Thanks very much Hi
I have a list of string variables, which all ends with "_STI". How can I group them together so that I can perform the same operations to them. For example, I want to assign a number to all the variables ends with "_STI".
Thanks very much string identifier operation MATLAB Answers — New Questions
hi i started the matlab onramp course and im stuck on this further practice question i wld appreciate if anyone cld help me or even give an hint
Post Content Post Content #onramp MATLAB Answers — New Questions
Faster alternate to all() function
I am running a simulation of 100s of thousands loop and I am noticing that inside the each loop an all() function consumes almost 95% of the time. I want a faster alternate to this.
So here is my algorithm:
varname=rand([24665846,4])
for i=1:1000000
idx=idxkeep(i);
ind1=all(varname(:,1:4)==varname(idx,1:4),2);
ind=find(ind1);
endI am running a simulation of 100s of thousands loop and I am noticing that inside the each loop an all() function consumes almost 95% of the time. I want a faster alternate to this.
So here is my algorithm:
varname=rand([24665846,4])
for i=1:1000000
idx=idxkeep(i);
ind1=all(varname(:,1:4)==varname(idx,1:4),2);
ind=find(ind1);
end I am running a simulation of 100s of thousands loop and I am noticing that inside the each loop an all() function consumes almost 95% of the time. I want a faster alternate to this.
So here is my algorithm:
varname=rand([24665846,4])
for i=1:1000000
idx=idxkeep(i);
ind1=all(varname(:,1:4)==varname(idx,1:4),2);
ind=find(ind1);
end matlab, all() MATLAB Answers — New Questions
How to add space between heading of txt file?
Hey,
I have created a txt file and successfully saving data in tabular form But I am having problem in introducing the spaces between the heading of each column. It appears as "h1 h2 h3" but i want space between them so that i may look like "h1______h2_______h3" (without blanks, used to introduce space)
Thanks.Hey,
I have created a txt file and successfully saving data in tabular form But I am having problem in introducing the spaces between the heading of each column. It appears as "h1 h2 h3" but i want space between them so that i may look like "h1______h2_______h3" (without blanks, used to introduce space)
Thanks. Hey,
I have created a txt file and successfully saving data in tabular form But I am having problem in introducing the spaces between the heading of each column. It appears as "h1 h2 h3" but i want space between them so that i may look like "h1______h2_______h3" (without blanks, used to introduce space)
Thanks. headings spacing of txt, txt file MATLAB Answers — New Questions