- #1
sgvaibhav
- 68
- 0
Hi.
I will try to simplify my question to make it clear.
I perform huge calculations worth 70 lines. Beginning by syms x and y.
I get two functions/paramters 'Wnet' and 'SFC' in terms of x and y (VERY HUGE EQUATION)Now i want to plot a very complicated 2D graph.
The script below allows me to plot in 2D but for that, i have to first run first script, get Wnet and SFC and then copy the values and make another function in another script to plot.
This works, However this code is very inconvenient since i have to copy the big output from first script, change x to x(i), y to y(j), * to .* , / to ./ and ^ to .^ and then i have to paste to second script to plot the graph.Instead i combined to make one big script to directly plot the graph (trying to convert the symbolic equation into double), however i get an error to convert symbolic equation to double. Here is is the second half of the big code, which has the error.
However when i run this, i get the error
? Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in ==> sym.sym>sym.double at 936
Xstr = mupadmex('symobj::double', S.s, 0);
Error in ==> Working at 14
x1=double(Wnet);Help me =)
If you are still confused with the question, let me know, i will try to clarify it more.
I will try to simplify my question to make it clear.
I perform huge calculations worth 70 lines. Beginning by syms x and y.
I get two functions/paramters 'Wnet' and 'SFC' in terms of x and y (VERY HUGE EQUATION)Now i want to plot a very complicated 2D graph.
The script below allows me to plot in 2D but for that, i have to first run first script, get Wnet and SFC and then copy the values and make another function in another script to plot.
Code:
clear
for i=1:6;
x(i)=5.*i;
for j=1:5;
y(j)=1000+(100*j);
%i ran the first script, copied this from output and pasted here
x1(i,j)=(99.*((57443.*((4018.*y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984))./5 - (57443.*y(j))./50 + (2894969.*x(i).^(200./623))./50))./(50.*((57443.*y(j))./50 - 41160000)) + 57443./50).*(y(j) - y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984)))./100 + (99.*(y(j) - y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984)).*((57443.*((4018.*y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984))./5 - (57443.*y(j))./50 + (2894969.*x(i).^(200./623))./50))./(50.*((57443.*y(j))./50 - 41160000)) - (57443.*((57443.*y(j))./50 - (57443.*y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984))./50))./(50.*((57443.*y(j))./50 - 41160000)) + 57443./50))./100 - (2894969.*x(i).^(200./623))./10 + 2894969./10;
% i copied this from output of first script and pasted here
y1(i,j)=-(((57443.*y(j))./50 - (57443.*y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984))./50)./((57443.*y(j))./50 - 41160000) - ((4018.*y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984))./5 - (57443.*y(j))./50 + (2894969.*x(i).^(200./623))./50)./((57443.*y(j))./50 - 41160000))./((99.*((57443.*((4018.*y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984))./5 - (57443.*y(j))./50 + (2894969.*x(i).^(200./623))./50))./(50.*((57443.*y(j))./50 - 41160000)) + 57443./50).*(y(j) - y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984)))./100 + (99.*(y(j) - y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984)).*((57443.*((4018.*y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984))./5 - (57443.*y(j))./50 + (2894969.*x(i).^(200./623))./50))./(50.*((57443.*y(j))./50 - 41160000)) - (57443.*((57443.*y(j))./50 - (57443.*y(j).*(66875./(57036.*x(i))).^(2528214091580831./18014398509481984))./50))./(50.*((57443.*y(j))./50 - 41160000)) + 57443./50))./100 - (2894969.*x(i).^(200./623))./10 + 2894969./10);
x2=x1';
y2=y1';
end
end
plot(x1,y1,x2,y2)
This works, However this code is very inconvenient since i have to copy the big output from first script, change x to x(i), y to y(j), * to .* , / to ./ and ^ to .^ and then i have to paste to second script to plot the graph.Instead i combined to make one big script to directly plot the graph (trying to convert the symbolic equation into double), however i get an error to convert symbolic equation to double. Here is is the second half of the big code, which has the error.
Code:
%internal memory from computing the last 70 lines
% (stored internally) Wnet=(99*((57443*((4018*y*(66875/(57036*x))^(2528214091580831/18014398509481984))/5 - (57443*y)/50 + (2894969*x^(200/623))/50))/(50*((57443*y)/50 - 41160000)) + 57443/50)*(y - y*(66875/(57036*x))^(2528214091580831/18014398509481984)))/100 + (99*(y - y*(66875/(57036*x))^(2528214091580831/18014398509481984))*((57443*((4018*y*(66875/(57036*x))^(2528214091580831/18014398509481984))/5 - (57443*y)/50 + (2894969*x^(200/623))/50))/(50*((57443*y)/50 - 41160000)) - (57443*((57443*y)/50 - (57443*y*(66875/(57036*x))^(2528214091580831/18014398509481984))/50))/(50*((57443*y)/50 - 41160000)) + 57443/50))/100 - (2894969*x^(200/623))/10 + 2894969/10;
% (stored internally) SFC=-(((57443.*y)./50 - (57443.*y.*(66875./(57036.*x)).^(2528214091580831./18014398509481984))./50)./((57443.*y)./50 - 41160000) - ((4018.*y.*(66875./(57036.*x)).^(2528214091580831./18014398509481984))./5 - (57443.*y)./50 + (2894969.*x.^(200./623))./50)./((57443.*y)./50 - 41160000))./((99.*((57443.*((4018.*y.*(66875./(57036.*x)).^(2528214091580831./18014398509481984))./5 - (57443.*y)./50 + (2894969.*x.^(200./623))./50))./(50.*((57443.*y)./50 - 41160000)) + 57443./50).*(y - y.*(66875./(57036.*x)).^(2528214091580831./18014398509481984)))./100 + (99.*(y - y.*(66875./(57036.*x)).^(2528214091580831./18014398509481984)).*((57443.*((4018.*y.*(66875./(57036.*x)).^(2528214091580831./18014398509481984))./5 - (57443.*y)./50 + (2894969.*x.^(200./623))./50))./(50.*((57443.*y)./50 - 41160000)) - (57443.*((57443.*y)./50 - (57443.*y.*(66875./(57036.*x)).^(2528214091580831./18014398509481984))./50))./(50.*((57443.*y)./50 - 41160000)) + 57443./50))./100 - (2894969.*x.^(200./623))./10 + 2894969./10);
for i=1:6;
x(i)=5.*i;
for j=1:5;
y(j)=1000+(100*j);
x1=double(Wnet); %THE ERROR CODE
y1=double(SFC); %THE ERROR CODE
x2=x1';
y2=y1';
end
end
plot(x1,y1,x2,y2)
However when i run this, i get the error
? Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in ==> sym.sym>sym.double at 936
Xstr = mupadmex('symobj::double', S.s, 0);
Error in ==> Working at 14
x1=double(Wnet);Help me =)
If you are still confused with the question, let me know, i will try to clarify it more.